How to hide affiliate links

Learner My Affiliate Progress task of the day has been looking at how to hide affiliate links. I had seen this technique in use on other affiliate sites and blogs and thought I’d give it a try. The reason for using this technique is that some people simply do not like, and will not click on affiliate links. Other kind souls, can also look at your un-hidden links and set up and buy via their own link.

On having a bit of a dig around on the internet to find out how to set up these hidden links, it appears there are a wide variety of methods. So below I will describe a method using .PHP files to redirect, and also a nice little redirect plugin call GoCodes, which is the method I eventually settled on myself.

1. Using .PHP Redirect

As I’m not one to overcomplicate matters unless absolutely necessary, I chose to try the simplest .PHP redirect method I could find! However, this method does have the added benefit of producing a very natural looking URL.

The method involves creating a very simple .PHP file for each of your affiliate links (other methods use a single file containing all your links).

Save the file as affiliatename.PHP or similar

Edit the file and insert the following three lines of code:

<?php

header( ‘Location: http://www.myaffiliatecode.com‘ ) ;

?>

Replace www.myaffiliatecode.com with your own affiliate URL, and then set up your links to point to:

http://www.yoursite.com/affiliatename.PHP

If you get any error messages when testing the new links, make sure the code in the .PHP file has no spaces either before or after, as this seems to prevent it from working.

My thanks to EarnersBlog where I found this and loads more useful tips.

Although it actually worked a treat, I should point out that I have seen one comment that suggested the method described above may not be search engine friendly. I can’t currently find anything to back that claim up but for this reason and also for sheer ease of use I chose to adopt the GoCodes plugin.

2. GoCodes Plugin

I downloaded GoCodes and activated it. This gives you two new WordPress menu items for GoCodes under Settings and Tools.

There are only two items under settings. I left the URL trigger at the default setting of “go” and checked the tickbox to make the redirect links no-follow.

In the tools menu under GoCodes, you can now add individual re-directs for each of your affiliate links with nice easy to remember names such as in my case justhost and micronichefinder. In the target URL you insert your actual affiliate URL code.

There were a couple of other things I had to do to actually make this plugin work. You need to add the following line of code to your .htaccess file.

This goes right above the line that says “# BEGIN WordPress”:

RewriteEngine On RewriteRule ^go/([a-zA-Z0-9_-]*)/?$ /index.php?gocode=$1 [L,R]

My problem was that I didn’t appear to have a .htaccess file, but with a bit more digging I found out that this file is only created when you set up your Permalink structure in WordPress. Again, this is easily achieved in your Settings/Permalinks and allows you to set a user friendly structure for how the individual pages in your blog are named.

After that just adjust your links to for example  go/justhost and they then work like this –  justhost

One other neat thing is that the URL www.affiliateprogress.com/go/justhost is also a fully working link which I can use to promote my affiliate products in articles on other sites rather than providing a link pointing to an affiliate site. It is worth checking in the terms and conditions of your affiliate program to make sure that this is allowed however!

I should point out that whilst this particular plugin does not appear to have a detrimental affect on performance, the cumulative effect of multiple plugins could slow your WordPress installation down. So use plugins only when necessary.

So that was that for my first delve under the hood of WordPress. Hopefully the info above will prove useful to other newbies.

All the best,

Affiliate Progress

One thought on “How to hide affiliate links

  1. Interesting, did you plan to continue this article?
    Thanks
    Ivan

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

CommentLuv badge

Subscribe without commenting