Site Replication overview

Replicated site feature allows you to create personalized sites for your affiliates. This means that you create one site, use variables like {$firstname}, {$lastname} and Post Affiliate Pro (PAP) will create its personalized variation for each of your affiliates automatically.

Requirements and notes

  • The site replication feature requires to have mod_proxy and mod_rewrite modules enabled in your webserver.
    If you have a shared server with HostGator, then mod_proxy will not work as expected due to having the "ProxyPreserveHost" module turned on.
  • Consult this article if you have problems with the mod_proxy module.
  • Without mod_proxy only the 'Site replication is at default location' URL type can be used. That means the replicated page URL would look like https://URL_TO_PostAffiliatePro/sites/ReplicationName/affiliateID. Read more here.
  • Replicated sites are cached for 5 minutes. Cache can be cleared by clicking Save on the Replicated site banner.
  • Replicated site banner can be automatically stopped, read more further under the explanation of the Disabled checkbox.

Activate the feature

In the merchant panel navigate to Configuration > Features > Site replication and click the Activate button. After the restart of the application, this feature will be available. If instead you can't find the site replication feature on the list you are going to need to upgrade your plan/license to higher variation.

 

Create a replicated site banner

Go to Banners -> Banners manager -> Add banner and choose Replicated site. You will get the following screen:

 

Here is a short explanation of the fields you can see:

  • Name - how you and your affiliates will see this particular banner in the list of banners.
  • Hidden banner - if checked the banner won't be visible to affiliates but will still work.
  • Disabled - if checked the site replication will not work at all, we will automatically disable the replication if the site which is being generated generates too many errors. If the banner should be automatically disabled the system will send you an email to notify you. The errors which caused the site replication to be disabled can be found in Tools->Event logs section of the software.
  • Campaign - the campaign under which this banner will track.
  • Description - description for the banner visible in affiliate panel
  • Replicated site URL - at which URL will the replicated pages be created, default doesn't require any additional settings, custom requires adding .htaccess code to your hosting and your hosting must meet the requirements. More about URL here.
  • Replicated site preview - listbox with affiliates which shows you their replicated site links so you can easily see how it looks for each affiliate, the banner must be set up and saved for the preview to work!
  • Replicated site files - URL of the website which should be replicated by the system. More on this here.
  • Additional options:
    • recognize %7B, %7D, and %24 as '{', '}', and '$' - use this option if for any reason you can't add the variables to your website as for example {$firstname} but instead you need to use %7B%24firstname%7D
    • use default affiliate for wrong affiliate url - if in the replicated URL a wrong affiliate ID will be used and the system will not find any affiliate by following the usual tracking logic with visitor's cookies and IP address then it will display replicated website of the affiliate selected under Configuration > Tracking settings > Save unreferred sale/lead.
      If you don't want to be saving the unreferred sales it is enough to enable this option, select an affiliate there, save the screen, disable the option and save the screen again.
      If this is not checked and wrong URL is entered a site like this will display.
    • Add GET tracking parameters to source page - PAP will send hidden GET parameters with the tracking parameters a_aid, a_bid and a_file to the replicated site so you can access them in PHP as for example $_GET['a_aid']
 
 

Upload replicated site files or modify the code of your site

Either upload all files to the Replicated site folder or to a custom folder in your server that you define in the 'Replicate external URL' field. 
For more information see Replicated site files
Or simply refer to your site to be replicated  in the 'Replicate external URL' field and into your site's source code add the following JavaScript code where the affiliate info should show up:
<!-- PAP Integration snippet -->
<span id="affinfo" style="display:none">You have been referred by {$firstname} {$lastname}</span>
<script type="text/javascript">
if (typeof AffiliateID != "undefined") {
    document.getElementById('affinfo').style.display = "block";
}
</script>
<!-- PAP Integration snippet ends here -->
 

Test the created replicated site

Now the replicated site is created and you can preview it by clicking the link in next to the "Preview for" field.

 

The easiest way to replicate a site

In order to replicate any site successfully, lets say example.com do the following: 
  1. In Post Affiliate Pro merchant panel navigate to Banners -> Banners manager -> Add banner and choose Replicated site. Fill in the Name, choose the campaign. 
  2. At the Replicated site URL section select the desired url and press the Create button. After that press the "Generate .htaccess for this location". 
  3. Copy that code and append it to the .htaccess file located in the location given by the "Generate" button.
  4. Then press the "Check if .htaccess is working for this location" . If it says "Site replication .htaccess is working at this location" that's perfect.
    If it says: "Site replication .htaccess is not set up at this location or it is not working correctly. Please make sure that you have mod_rewrite and mod_proxy enabled in your Apache configuration", then contact the administrator of your web-server and ask him to ensure that both mod_rewrite and mod_proxy modules are enabled and working properly. To test if mod_proxy is enabled and works properly follow the instructions here.
  5. For Replicated site files choose the "Replicate external URL" option and enter: https://example.com/  and into the Files to process line enter: *.htm,*.html,*.php,DIR_INDEX
  6. Into your site where the affiliate information should be displayed if the affiliate's replicated site is visited place the following code with the text and variables you wish to display, if you want more info check the Replicated site files guide:
<!-- PAP Integration snippet -->
<span id="affinfo" style="display:none">You have been referred by {$firstname} {$lastname}</span>
<script type="text/javascript">
if (typeof AffiliateID != "undefined") {
    document.getElementById('affinfo').style.display = "block";
}
</script>
<!-- PAP Integration snippet ends here --> 
×