Hey people, welcome back! I hope you have recovered from your New Years celebrations and have not broken too many of your resolutions. I know I have broken at least one, which was to not buy any more products until I have started to make some money. Oh well, I’m sure it will come in useful.
That’s the pleasantries over, let’s get down to the point of this post. When you are promoting products, such as the upcoming Partnership to Success program (see what I did there?!) if you are using naked affiliate links, people can remove your affiliate code and you lose out on your commission. Now, if you hover over the Partnership to Success link until the link text appears in the bottom left of your browser, you will see it is a nice, short https://stevenspiller.com/likes/P2S. Much better than the default http://XXXXXX.hop.clickbank.net/ you will normally see.
I created this video to show people how easy it is. For those who are are more comfortable with text instructions, keep reading!
Why Cloak Your Affiliate Links
Anyway, that’s not the point of today’s post. The point (if you didn’t guess from the title) is the how to cloak affiliate links. If you are wondering what cloaking is, it is the method of using one link (https://stevenspiller.com/P2S) to send user to a webpage (http://XXXXX.hop.clickbank.net/).
Now, you may be wondering why you should be “cloaking” your affiliate links. The main reason used to be to hide the fact you are an affiliate from search engines. It is believed that Google penalizes affiliates, or at least websites with a large number of affiliate links on a page. Whether this is true or not is open to discussion.
Another reason is that it helps to prevent affiliate hijacking; which is where people can replace your affiliate code with theirs or just removing your code altogether. The best reason, in my opinion, is that you may need to put the link in several different locations. If you need to update the link for whatever reason, you only need to change it in one place. Saves hunting around in old posts and missing out the one link that someone clicks on!
How to Cloak Your Affiliate Links
Now you have an idea of the why you should be cloaking your affiliate links, let’s have a look at the how. The process of cloaking your affiliate links involves three simple steps.
- Add a rule to your robots.txt file
- Install a plugin to handle re-directs
- Use the new style links instead of your affiliate links
1. Add a Rule to robots.txt
On most WordPress websites, robots.txt doesn’t actually exist! It is auto-generated by WordPress when requested. To check if your website is creating the robots.txt file on the fly, look in the root directory of your website using an FTP client or the File Manager icon in cPanel. If you do not see a robots.txt file in the root of your website, WordPress is creting it on the fly. To create a robots.txt you can edit, first got to http://your.website.com/robots.txt. You should get something like the following:
User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/
Copy this into a text file called robots.txt. Now decide on how you are going to construct the cloaked links. While you can use pretty much anything do remember that people will be seeing what you use. So using /buythis/, /ineedmoney/, /justbuyitalready/, etc. is not such a good idea. The popular choices are /likes/, /go/, /recommends/, etc. You then need to add this as a disallowed browse location. So for /likes/ you would add:
to the bottom of your robots.txt file. Your file should end up looking similar to:
User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/ Disallow: /likes/
Now upload your robots.txt file to the root of your website.
2. Install a Redirect Plugin
Once you have your robots.txt file in place, you need a way of telling a visitors browser what to do with the link. There are several plugins for WordPress that will do this easily for you. I use a simple one called Redirection. Install and activate Redirection in the usual way. Once installed, you access the Redirection admin page from Tools->Redirection.
As you can see from the screenshot, I have already created some redirections, or cloaked links. The process of creating these is very quick and easy:
Put your chosen link into the Source URL: box, e.g /likes/SimpleTrafficSolutions
- Leave the Match, Action and Regular Expression boxes as is
- Enter the affiliate link to be cloaked into the Target URL: box; e.g http://XXXXX.hop.clickbank.net
- Click Add Redirection button
You need to edit the redirection you just created by clicking on it in the green list. This will expand the box underneath. Set the Title to something easy for you to remember why you created this link and set the HTTP code to 302 – Found. This is known as a temporary redirection. There is another type called permanent, which is not what we want.
3. Use the Redirect Link
Now when you create the advert, link in post, or whatever you are creating the affiliate link for, just use the redirect link instead.
That’s it! There is one small caveat when using the Redirection plugin though. You have to have the Administrator role before you can create, edit or delete redirection links. Non administrators can still use the links in posts and pages, however. There is a premium (i.e. paid for) plugin called Pretty Link Pro which allows you to specify the user roles allowed to create redirections. If you have people writing content for you who are not administrators, I would suggest paying for Pretty Links Pro so you can let them create & update their own redirections without having to wait for the site administrator to do it.