Hiding Affiliate Links

Create a file something like getAffiliateLink.php

And

Include this file to where you want see these link/s

$baseUrl = 'http://' . $_SERVER['HTTP_HOST'];
$requestURI = $_SERVER['REQUEST_URI'] . 'webpage1/prod1';
$requestURI = str_replace('tut6/', '', $requestURI);
$affiliateLink = $baseUrl . '/tut6/products/sample' . $requestURI;
<a href="<?php echo $affiliateLink; ?>">Affiliate</a>

and create .htaccess
and add these scripts below:

RewriteEngine On
#example site is http://www.google.com
RewriteRule ^products/sample/?$ http://www.google.com/affiliation-$1/?%{QUERY_STRING} [R=302,L]
RewriteRule ^products/sample/?$ http://www.google.com/affiliation/?%{QUERY_STRING} [R=302,L]
RewriteRule ^products/sample/([a-zA-Z0-9]+)/?$ http://www.google.com/affiliation-$1/?%{QUERY_STRING} [R=302,L]
RewriteRule ^products/sample/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ http://www.google.com/affiliation-$1/$2%{QUERY_STRING} [R=302,L]

//end
Then that’s it… ^^

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.