Which other industry gives you this much Freedom?

Cloaking & Ranking Your Affiliate Links

03. Jan 2007 | 22 Comments

Cloaking Affiliate LinksThere’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:

  1. <?php
  2. $links = array(
  3. "earnersblog" =>; "http://www.earnersblog.com",
  4. );
  5. header("Location:".$links[$_GET['site']]);
  6. exit;
  7. ?>

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:

  1. <?php
  2. header( 'Location: http://www.earnersblog.com' ) ;
  3. ?>

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 :)

Enjoy this post? Get the RSS Feed

22 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?

Stuart 03. Jan 2007, 11:46 am

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

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 :-)

Stuart 03. Jan 2007, 9:41 pm

Nice Xfiver you’ve actually picked up on something I was going to touch on in a later post ;)

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.

Stuart 04. Jan 2007, 11:56 am

There’s no reason why this shouldn’t pass the referrer….

Are you using Zonealarm or anything similar Rafael?

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.

Stuart 30. Jan 2007, 9:27 am

Thing is though Ben, we “want” the links to get indexed, that way we can rank them & hopefully get Organic Traffic straight through the link.

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….

Add a Comment






Close
E-mail It