Cloak Affiliate Links With PHP Redirect Script
Using a PHP redirect script to cloak and redirect affiliate links is a good idea. Let me explain…
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.
Today 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. Create Tidy Affiliate Links
Many 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 short and 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 few hundred blog posts over a couple of years promoting those widgets – and then they close 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, then I need to find all those links and change every single one of them. Aarrgh! 👿
If I’d used a redirect script, I’d only have 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?
Maybe. I’m not really sure… Even though I’ve been reading about this stuff for years, I have to admit that I still don’t totally get it, and to be honest, I don’t think it really matters that much any more anyway so it’s not really on my radar.
Reasons number one and two are much more important!
Use A Free And Easy PHP Script To Redirect Your Affiliate Links – NO Software or Plugins Required!
Awesome… Now 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’ so you can save as .php rather than .txt)
- Upload the file to either the root directory of your hosting account or (preferably) into a folder created specifically for these scripts (eg http://yourdomain.com/go/)
- Test to make sure it works – SUPER IMPORTANT!
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.