PHP Redirect Script: How To Cloak & Redirect Affiliate Links
Once upon a time, link cloaking and redirects were sneaky techniques used by internet marketers to try to trick the search engines into not realising that affiliate links, were actually affiliate links.
But then the search engines got smarter and that all fell by the wayside.
Nowadays, the search engines actually encourage the redirection of links.
Google Says Redirect Affiliate Links
This quote, copied from Google Webmasters makes their stand on redirection of links quite obvious. It is a practice that they do encourage.
Note that PPC (pay-per-click) advertising links that don’t pass PageRank to the buyer of the ad do not violate our guidelines. You can prevent PageRank from passing in several ways, such as:
- Adding a rel=”nofollow” attribute to the
- Redirecting the links to an intermediate page that is blocked from search engines with a robots.txt file
Why Redirect Affiliate Links?
Well there are a couple of reasons.
1. Tidy affiliate links
Some of the affiliate links are really looong and really ugly! I wouldn’t blame readers for being suspicious about them if they don’t know what they are. Using a redirect allows me to use a pretty link that matches where I’m sending the reader.
2. Efficiency & Simplicity
The use of a redirect script means that if I need to change an affiliate link, I only need to change it in one place. For example, say I was selling widgets and I wrote a whole load of blog posts over a couple of years promoting those widgets and then they closed their affiliate program. Well, that’s not the end of the world. I’ll just find another widget affiliate program.
BUT – if I want to keep the sales I’m making from my already established pages, I need to find all those links and change every single one of them. Aarrgh! 👿
If only I’d used a redirect script. I’d have only had to change one link…..
3. Link juice? (I wonder what that tastes like…)
The third reason is something to do with leaking link juice to the pages that are being linked to via the affiliate links. Is that the same as the pagerank that Google talks about in that quote? Even though I’ve reading about this stuff for years, I don’t really get it and I don’t think it really matters that much any more anyway and so it’s not really on my radar. The first two reasons are much more important!
The Free And Easy Affiliate Link Cloaker – NO Plugins OR Software Required!
Just Gimme The Code!
I know… Ok here it is. Copy and paste to your hearts content… 😉
- Copy php code into a text document (Notepad)
- Paste your affiliate link in between the quotation marks (“)
- Save as a name that makes sense with .php on the end (make sure you change the file type dropdown to ‘All Files’)
- Upload the file to either the root directory of your hosting account or (preferably) into a folder created specifically for these scripts (eg http://domain.com/go/)
- Test to make sure it works!
One final thing that I forgot to mention in the video. Make sure you add a line to your Robots.txt file to block the search engines (this is what Google is talking about in the quote above).
Simply add the following line:
Replace /go/ with whatever name you give the directory that holds your redirect scripts.
And that’s how to cloak affiliate links! Easy.
If you have any questions or comments please feel free.
P.S. Looking for really cool affiliate programs? Check out my list of favourites.