Keeping the PURL

There are times when you may want to keep the PURL displayed in the URL, preventing to redirect to the longer campaign URL.  This is possible, but with a caveat - you will only be able to have one campaign per domain name.  If you need to have multiple campaigns running on the same domain, this will not be possible.  But with that in mind, the steps below will walk you the the required modifications.

1. Copy the full campaign URL

To find the full campaign URL, click on a PURL from with your Purlem dashboard.

Then copy the full URL of the shown page.

Remove everything after the question mark (?) on the URL, and replace with 

2. Create a new purl.php file 

This file should be placed in your domain's public root directory. Then, copy the code below into that file.

<body style="margin:0px;padding:0px;overflow:hidden">
    <iframe src="PASTE_URL_HERE" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>

function get_domain() {
    $url = $_SERVER['SERVER_NAME'];
    $last = strrpos($url, '.');
    if ($last === false) {
      return false;
    $next_to_last = strrpos($url, '.', $last - strlen($url) - 1);
    return substr($url, $next_to_last+1);

3. Modify the purl.php file

Paste in the URL (copied from step 1), to where is says PASTE_URL_HERE.

Delete everything after the question mark in the URL. In our example, this would be:$test=Y

And replace with the following:

purl=<?= $_GET['purl']; ?>&page_order=1&domain=<?=

For our example, the final URL is:<?= $_GET['purl']; ?>&page_order=1&domain=<?= get_domain();?>

4. Modify the .htaccess file

Find the Line that begins with RewriteRule. Replace that line with the following:

RewriteRule ^.*$ purl.php?purl=%2&domain=%3.%4