Hide your affiliate links – Best way to do it

hide affiliate linksYou might be in danger if you don’t hide or cloak your affiliate links. Google could penalize your site if they don’t like what they see. Someone could hijack your links and send the traffic to their own affiliate link. If the affiliate program modifies the links then you’ll have to go back to all your articles and manually change one by one your link. Redirecting your affiliate links could fix all those problems!

Video tutorial

If you are lazy or don’t have time to read everything on the page, you can watch my summary video which explains everything. Come back to this page to get the links or codes to use.

Various methods to hide links

You could cloak your links using an HTML redirect, via the .htaccess, URL Shortener or using PHP Redirect. The best way is definitely with PHP.

URL Structure

In my opinion, the best way to build your affiliate link structure is by using directories, so you don’t have any filenames inside the URL. Within your root directory create a new folder called RECOMMENDS. Each time you have a new link to add then create a sub directory with the name of the product. So it would look like this: http://yourdomain.com/recommends/productname/. That looks really good and clean. Inside each sub-directory you need to create an INDEX.PHP file.

Code to add inside index.php

Add this code inside your index.php which you need to upload to your new sub-directory. Because the name is INDEX, the browser will automatically load the file and launch the redirection.
<?php
header('Location:AFFILIATE_URL');
exit;
?>

Nofollow links

Make sure to add the rel=”nofollow” tag on your URLs. This way, you are telling Google not to consider this links as a backlink coming from your site. The HTML of the link would become:

<a href="http://yourdomain.com/recommends/productname/" rel="nofollow">BUY MY PRODUCT</a>
cloak affiliate links

Modify your robots.txt

To add another barrier against search engine’s bots, you can add a disallow in your robots.txt file. This file should be in your root directory ie: http://yourdomain.com/robots.txt. You are telling Google not to access the files within a certain directory. Add the following in your robots.txt:

Disallow: /recommends/

Track your affiliate links with Google Analytics

If you want to see how many times each link was clicked in Google Analytics then you can tag each individual link inside the index.php file. Use the Google URL Builder on this page to create your tracking elements.

URL shortener

Using a URL shortener could add another protective layer although they are generally 301 redirects. Also they’ll offer some interesting statistics about the people who clicked so you could start by shortening your link first. I’m just a little worried that the 2 redirections slow down the loading and if either is broken then the user will get an error.

[box type=”tip”]LINK 1 –> LINK 2 is better than LINK 1 –> LINK 3 –> LINK3[/box]

Here are some samples of the statistics you’d get with Goo.gl & Bit.ly:

bitly url shortenergoogle url shortener

Too many Nofollow could hurt your site

Some people have been penalized by Google because most of their outbound links were nofollowed. For Google that is over-optimization so make sure you don’t just link out to your affiliate products. Insert some dofollow outbound links to webpages which offer a complement of information on your topic.

WordPress Plugins or not?

There are numerous plugins for WordPress to help with hiding your affiliate links. I prefer to do it the manual way but you can try the following plugins:

External Resources:

I didn’t cover something about hiding your aff links? Then check out these sites which offer some more great info:

 

Let me know if you have any questions or comments. 🙂

Similar Posts