How to Hide Affiliate Links

How to Beat the Hackers

There are many schemes out there to stop people changing your links but in my opinion there is only one worth considering – the “htaccess technique”. It does require a certain level of technical expertise to set up but its not that difficult and this tutorial will take you through the steps needed.

A popular way to make money is by use of affiliate links. This is where you advertise a product on your website and the product owner pays you a percentage of the purchase price when the person who follows the link subsequently buys the product or service.

For example a (fictitious) company Brilliant Books sells books at www.brillbooks.com and has an affiliate scheme where they pay 10% to you for every person you send to them who buys one of their books. They do this by getting you to register as an affiliate and give you a unique affiliate id code of 1234.

They know it’s you who sent the potential buyer to them because you link to www.brillbooks.com?affid=1234 instead of to www.brillbooks.com

Some people write malicious programs that they install on computers without the owners knowledge that will for example alter your link to brillbooks so that it says www.brillbooks.com?affid=6666 Now when the potential buyer clicks on the link the 10% affiliate fee goes to someone else.

So how do you stop this?

1. Find out if your web host is suitable.

This method only works for web servers that use Apache (as far as I know). Go to www.netcraft.com/whats and type in your website address into the “whats that site running” box. Then look under the “server” column and look for the word “Apache”. If its there then this method will work.

2. What is htaccess. Where is it located.

htaccess is a configuration file that contains instructions for the web server. You may already have one ( or more than one as they can work on a per directory basis). To find out fire up your ftp program or file browser or whatever you normally use to upload your website to your webserver and have a look.

htaccess is stored as a hidden file on the webserver which means its filename will be .htaccess
Your ftp program may by default not show you hidden files so you may need to enable viewing hidden files to be able to see .htaccess
Look for .htaccess in the same folder as your website’s index file. (index.html, index.htm, index.php or similar)

If you find one then you can edit it using any editor that is suitable for text files. Watch out on Windows systems that it doesn’t try to change the name to something more Windows friendly. This is because a file named .htaccess is alien to Windows. Usually putting quotes round the name when you do Save As will solve any problems i.e. save as “.htaccess”

If you don’t find an existing one then create a new one.

3. What changes do I need to make to .htaccess

Here is an example of the changes you need to make. Just add all the following at the top of your .htaccess file. Don’t touch anything that’s there already.

<ifmodule mod_rewrite.c>
RewriteEngine On

RewriteRule anyfilename.htm http://myaffid.blueberryc.hop.clickbank.net/?tid=LOGO1 [R=301,L]

</ifmodule>

4. Now change example code to real code

Where I have anyfilename.htm you should put a filename appropriate to your situation. e.g. if you were linking to a book website and a book about rare birds you might put rarebirds.htm This filename can be anything you want as long as it DOESN’T already exist.

Where I have put http://myaffid.blueberryc.hop.clickbank.net/?tid=BIRDS1 you should put your real affiliate id link as provided by your affiliate website.

Leave the [R=301,L] alone. It tells the webserver to redirect any requests for rarebirds.htm to http://myaffid.blueberryc.hop.clickbank.net/?tid=BIRDS1

5. And finally

Edit your webpage and put your new cloaked website affilate link in place of the existing link.

For example you might have the following html:

<p>The people at Brill Books have some good books about <a href="http://myaffid.blueberryc.hop.clickbank.net/?tid=BIRDS1">Rare Birds</a>.</p>

You should change it to

<p>The people at Brill Books have some good books about <a href="rarebirds.htm">Rare Birds</a>.</p>

It no longer looks like an affiliate link but it is. Make sure you check it is working properly of course.

4 Responses to “How to Hide Affiliate Links”

  • I have been doing some research on link cloakers and came across your blog. I was not sure why I needed to cloak in the past – I guess I was in less competitive niches. Anyway thanks for the post

  • diymonkey says:

    A good idea is also to open the affiliate page in 100% width iframe so the user will not see the URL even in the browser address bar (that won’t work with some sites though)

  • any recommendations for an affiliate program. Which one pays the quickest?

  • Affiliate marketing is tough business; no wonder countless affiliates struggle to make mere pennies. This is a great post with excellent tips for newbie as well as established affiliates.

Leave a Reply

New Discussion Forum

We have teamed up with CrypticGFX.com who are providing a place to discuss our tutorials.

You can still post blog comments as before but if you want a more in-depth discussion have a look at Cryptic GFX.