Support Center

Apache PATH based PURL hosting setup

Last Updated: Dec 28, 2012 11:21AM MST

Setting up PATH based PURL hosting on Apache

purlHub's Landing Page technology supports all forms of Personalized URLs, providing marketers options and maximum control over the URL format.  Path based pURL resolution (i.e. http://www.mysSite.com/JohnSmithX3) is a popular format, as it co-associates the brand with the individual in a familiar URL fashion.

As a fallback, purlHub also supports Query String based pURL resolution (i.e. http://www.mySite.com/index.html?_purl=JohnSmithX3).  This is most useful for Landing Page testing and development in offline mode.  But has additional applications for cases where web server administrative support (IT) is limited, and the and the PURL URLs are distributed exclusively via email or a similar fashion supporting HTTP links.

This article offers a technical guideline to setup your Apache server for path based pURL resolution.  

With path based pURLs, the personal code is included in the path component of the URL.  To host pages in this fashion, the following steps need to be completed. 

  1. Register a DNS domain name for your site (mySite.com & www.mySite.com) and point it to the IP address of the webserver.
  2. Apache needs to be configured to serve a common document for all URL's that contain a personal code (aka: purlCode).  This common document serves as the primary Landing Page, and personalization stepping off point, for entry into the personalized version of your site.  In the example below, this common document is referred to as "index.html".

Using your preferred DNS Registrar, you'll need to register a host name and point it to your web server's IP address.  Then you'll need to configure an Apache Virtual Host.  Follow this simple how-to guide.

 Once your Apache server is setup to respond to requests for your host name (www.mySite.com), you'll just need to setup support for the purlCode in the path of the URL.  The only requirements are: (1) that the Standard Apache module "mod_rewrite.so" is included and enabled in the server config (commonly included by default), and (2) that the Virtual Host supports and allows per-directory .htaccecss files.  You may need to add an Options directive to your VirtualHost config to allow .htaccess rules.

The final step is to create and add the following text file to the DocumentRoot of your Virtual Host.

FileName: .htaccess
RewriteEngine On

RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.html


  • RewriteBase - Defines any sub-directory within the path, where your landing page exists.  In the above example, the document "index.html" exists in the root ("/") of the vhost.  If your solution requires hosting pURL pages from a sub-directory of your web server, then RewriteBase should be set to the URL path sub-directory component.
  • RewriteCond  %{REQUEST_FILENAME} -f
    Contain the pass-through rule to apply only to files that actually exist on the web server.
  • RewriteCond  %{REQUEST_FILENAME} -s
    Contain the pass-through rule to apply only to files that have a size greater than 0 on the web server.
  • RewriteCond  %{REQUEST_FILENAME} -l
    Contain the pass-through rule to apply only to  to valid symbolic links on the web server.
  • RewriteCond  %{REQUEST_FILENAME} -d
    Contain the pass-through rule to apply only  to existing directories on the web server.
  • RewriteRule ^.*$ - [NC,L]
    If any of the above conditions match, simply pass the request on (pass-through rule) and ignore the remaining rule.
  • RewriteRule ^.*$ index.html
    Internally rewrite the request to "index.html" prefixing any RewriteBase. in the context of the preceding rules, this will only apply If none of the conditions match.

At this point, Apache is setup to serve your Landing Pages with or without a purlCode in the URL.


Contact Us

  • Post a Public Question
  • Ask the Community
  • Email Us

Recent Discussions