Cloaking & Ranking Your Affiliate Links
03. Jan 2007 | 25 Comments
There’s a number of reasons why you’d want to cloak your affiliate links. The first is so that cheap webmasters can’t get the string & buy the product through their own link instead of yours. Secondly, you don’t want to make the links too obvious to your readers as some will just not buy through an affiliate link period.I’m going to look at two fairly easy ways to cloak your affiliate links. The first one involves a redirection script which holds an unlimited amount of URL’s. The second is slightly more time intensive, however it has extra advantages.
Mass Affiliate Link Redirection
This particular method allows you to keep all your affiliate URL’s in one php file. You can assign each URL a name, then call it whenever you want.
Create a .php file & call it redirect.php
Open up the file & insert the following code:
- <?php
- $links = array(
- "earnersblog" =>; "http://www.earnersblog.com",
- );
- header("Location:".$links[$_GET['site']]);
- exit;
- ?>
You can replace Earners Blog & the URL with whatever you want. You can also add as many other URL’s below this one as you want.
To call one of the links you need to call it using the name you’ve described it as. To call the link above we’d use the string:
http://www.yoursite.com/redirect.php?site=earnersblog
And there you have a very simple Mass Affiliate Link redirect script that can hold an unlimited number of URL’s.
Single Affiliate Link Redirection
I use this method to redirect single affiliate links. The advantages of using this method is that if you point enough link juice on the affiliate link you can sometimes get it to rank in MSN. This can mean free commissions from organic clicks. The url structure also looks much cleaner which will attract more clickthroughs.
Say I want to create a file to redirect to Earners Blog. Simply create a file called earnersblog.php
Inside the file place the following code:
- <?php
- header( 'Location: http://www.earnersblog.com' ) ;
- ?>
Now when you want to call the link just use http://www.yoursite.com/earnersblog.php
As you can see, using this method makes the link look much more like a static page. Therefore your reader is more likely to click & possibly buy. If you’re consistent & use this linking method throughout your site for external affiliate links you may find some of them ranking in MSN. This is generally dependant on the Anchor text you decide to use for the link.
Until next time
25 Comments on "Cloaking & Ranking Your Affiliate Links"
Jason Pedersen
03. Jan 2007, 11:28 am
I’ve always wondered how you were doing this. Do any of your affiliate urls have any PR?
Leonard
03. Jan 2007, 1:37 pm
Good post Stuart. Oh yeah, the good thing I like about this method is that when moused-over, the status bar also shows the redirected url.
Edwin
03. Jan 2007, 4:00 pm
I never tried this beaucse the average consumer doens’t know anything about affiliate links in my opinion, but i maybe wrong.
xfiver
03. Jan 2007, 6:25 pm
There is even a cooler method, with mod_rewrite. Basically, you have an .htaccess with rules that redirect URLS. So e.g. you have URL http://www.earnersblog.com/afflink
then in your .htaccess you setup a rule that /afflink will be redirected. If you code a PHP script that that has a nice interface and co do this then this is they way to go.
Clean, SEO friendly and nice
Rafael
04. Jan 2007, 2:57 am
I`ve just setup a similar redirect on a couple of sites and just realized this does not pass the referrer.
I`ve been looking on ways to do this since it`s kind of important for some of my stats, but I`ve had no luck.
Does anyone know how to do this?
Jason Pedersen
04. Jan 2007, 5:56 am
I suppose another nice thing about it is that you can track how many people are clicking that link and then check to see if people are signing up. It could tell you that maybe you need to do a better job selling the affiliate.
Jason Pedersen
04. Jan 2007, 11:17 am
I’m giving it a try. We’ll see how it goes. Thanks again Stuart.
Dominic
19. Jan 2007, 8:04 am
I use the .htaccess file for this. Are there extra benefits doing it this way?
Ben Cruikshank
30. Jan 2007, 3:24 am
This is a great idea, Stuart, and something I was going to look into doing. Another good thing to do in addition to this is to add this script into your robots.txt file so that it doesn’t get indexed.
Amit Nyamtabad
09. Nov 2007, 7:20 pm
Yes I agree that the link can also get indexed by this method !
The Grumpy Old Chef
15. Nov 2007, 6:30 pm
Nice post, Stuart.
It’s always a worry if you are going to get your commissions or not.
No problems now – looks good too.
Thanks.
John C.
22. Jan 2008, 10:00 am
Referer is not passed with php redirect.
ram
17. Mar 2008, 5:11 am
can we use that php links method in normal satic html website ,
or i have to use .httacess
which is better
gm
15. Apr 2008, 8:04 am
You can also use a 100% frame with the aff link as the target url. This way their page loads and the url in the address bar doesn’t change for the user. You can get a little more sophisticated and do a php script with a switch statement (or pull the links from a db) which writes the frame and selects whatever url. Advantage of this is that it will pass your site as the referrer. Using PHP you only need to write 1 script with all your urls vs 1 script/html page for every link….
Tarik
07. Jan 2009, 2:02 am
Great post, Stuart. I had to play around with the array function to get it working, but it’s still a very useful script.
Creating a separate file for each link is tedious and a pain in the you know what. Please provide more PHP tutorials on how to save time dealing with links, scripts, and functions.
Josh
23. Jun 2009, 1:57 pm
I realize this post is a few years old but won’t the search engines penalize you for having redirecting pages that are indexed?
I’ve always wondered how you were doing this. Do any of your affiliate urls have any PR?
Good post Stuart. Oh yeah, the good thing I like about this method is that when moused-over, the status bar also shows the redirected url.
I never tried this beaucse the average consumer doens’t know anything about affiliate links in my opinion, but i maybe wrong.
There is even a cooler method, with mod_rewrite. Basically, you have an .htaccess with rules that redirect URLS. So e.g. you have URL http://www.earnersblog.com/afflink
then in your .htaccess you setup a rule that /afflink will be redirected. If you code a PHP script that that has a nice interface and co do this then this is they way to go.
Clean, SEO friendly and nice
I`ve just setup a similar redirect on a couple of sites and just realized this does not pass the referrer.
I`ve been looking on ways to do this since it`s kind of important for some of my stats, but I`ve had no luck.
Does anyone know how to do this?
I suppose another nice thing about it is that you can track how many people are clicking that link and then check to see if people are signing up. It could tell you that maybe you need to do a better job selling the affiliate.
I’m giving it a try. We’ll see how it goes. Thanks again Stuart.
I use the .htaccess file for this. Are there extra benefits doing it this way?
This is a great idea, Stuart, and something I was going to look into doing. Another good thing to do in addition to this is to add this script into your robots.txt file so that it doesn’t get indexed.
Yes I agree that the link can also get indexed by this method !
Nice post, Stuart.
It’s always a worry if you are going to get your commissions or not.
No problems now – looks good too.
Thanks.
Referer is not passed with php redirect.
can we use that php links method in normal satic html website ,
or i have to use .httacess
which is better
You can also use a 100% frame with the aff link as the target url. This way their page loads and the url in the address bar doesn’t change for the user. You can get a little more sophisticated and do a php script with a switch statement (or pull the links from a db) which writes the frame and selects whatever url. Advantage of this is that it will pass your site as the referrer. Using PHP you only need to write 1 script with all your urls vs 1 script/html page for every link….
Great post, Stuart. I had to play around with the array function to get it working, but it’s still a very useful script.
Creating a separate file for each link is tedious and a pain in the you know what. Please provide more PHP tutorials on how to save time dealing with links, scripts, and functions.
I realize this post is a few years old but won’t the search engines penalize you for having redirecting pages that are indexed?
Supporters of the Cause
Popular Articles
- Ultimate Dofollow Social List
- Link Building Guide for 2008
- Become a Digg Power User in 48 Hours
- $800 a Day with Yahoo Answers
- Gmail Power Usage
- How to Work from Home - Efficiently
- Dominate Ebay Affiliate Program
- Making Money with Local Niche Directories
- Quick way to Make money with CPA Offers
- Diggproof & Speed up Wordpress
- Make Money with Clickbank & Articles
Recent Posts
- Recropical Link Cloaking - What you Need to Know
- Twitter me Timbers: 5 Ways to Profit from Twitter
- Sitelinks FAIL
- Looking for a Ruby/Python Developer
- Ultimate Dofollow Social & Link Building List
- Aweber Form Trick to Triple Profits
- How to Apply & get Accepted by Affiliate Networks
- Advanced Forum Link Building
- VPS Optimization Guide
- 13 Smokin Tips to Increase Adwords CTR
Affiliate Tools
- Affiliate Marketing Blogs
- Affiliate Network Reviews
- Web Hosting Reviews
- Affiliate Marketing Tools & Software
Guides / Example Sites
- Link Building Guide
- Discount Vouchers - Pligg
- Credit Cards - Wordpress

Enjoy this post? Get the RSS Feed















Not entirely sure since the TBPR hasn’t updated in a few months. I guess we’ll see come the next update