Friday , 22 August 2014
How to Cloak your Affiliate Links with WordPress

How to Cloak your Affiliate Links with WordPress

Affiliate marketing has been a popular way for bloggers to make money for years. It’s super easy to add affiliate links to any blog and the payoffs can be huge if done properly. The problem is that many bloggers don’t properly cloak their affiliate links which can have some serious consequences.

The problem with affiliate links is that they usually consist of a very long URL that contains a bunch of random numbers, letters, and symbols. These overly long affiliate links not only make your blog look unprofessional, it can actually dissuade people from clicking them. I’m here to teach you how to cloak your affiliate links in order to encourage more clicks from your visitors.

Why you should cloak your affiliate links

Affiliate links are straight up ugly! You definitely don’t want those mile long affiliate links making your blog look bad. I can’t believe the number of blogs I come across that don’t have cloaked affiliate links; it just makes me shake my head. Affiliate links that aren’t cloaked tend to look like spam a link which most people will avoid.

Properly cloaked affiliate links are just a simple redirect that will make the affiliate link look like it’s from your domain. However, once it’s clicked it’ll redirect to the actual affiliate site. This opens up so many great opportunities to share your affiliate links with people. An example of what a cloaked affiliate link would look like is  As you can see, it looks much better than a regular affiliate link.

Most bloggers have more than one affiliate company that they deal which means having a handful of affiliate links to deal with. By using this method to cloak your affiliate links, managing them will becomes much easier. If you ever need to change one of your affiliate links, you’d normally have to find every single instance of the link and change it manually. By cloaking your affiliate links, you only need to change them in one place.

How to cloak your affiliate links

There are three key factors in cloaking your affiliate links.

  1. Modify your “robots.txt” file to block your newly cloaked links to search engines
  2. Create 302 redirects using a WordPress plugin
  3. Parse your links with a rel=”nofollow” tag

Step 1

First, decide on a directory name for all of your affiliate links. Some examples of directory names would be:

go / likes / recommends / refers / out / r / loves / jump / partner / p / download

For example, let’s say you want to name the directory loves. Your link would look like this:

This domain URL looks much better than a standard affiliate link.

In order to create your new directory you will need FTP access. Just login into the root directory of your blog and create your new directory there. Next, you will need to add or modify a “robots.txt” file located in the root directory of your site by adding the following text:

User-agent: *

Disallow: /subfolder/

Replace “/subfolder/” with your own folder name that you added earlier. Congrats, now Google won’t index or crawl that folder.

If using an FTP client seems too complicated for you then I recommend that you download a WordPress Plugin called WP Robots Txt. It will allow you to modify the “robots.txt” file from within your WordPress admin site.

Step 2

It’s now time to set up the redirects for your affiliate links. You’ll be using a WordPress plugin called Redirection to do this. First, download and activate the plugin on your WordPress blog.

After you have the plugin installed properly, you can then set up your affiliate link redirects. When adding a redirect, use the new folder name that you created earlier followed by the name you’d like to give the affiliate. For example:


Now, enter the “Target URL” which would be the uncloaked affiliate link.

Affiliate Links Redirection Add New Redirection

The next step is to click on the “HTTP Code” dropdown box and change the default value of “301″ to “302″. The reason we change to 302 redirects is so that we’re not passing any PR (Page Rank) authority to the affiliate site.

Affiliate Links Redirection 302

You’re finished!

That wasn’t so hard now was it? Now that you know what you’re doing, you’ll be able to add as many affiliate links as you want using the Redirection plugin.

About Mike Howg

Web Designer and Writer | Founder of | Enjoys blogging with WordPress, messing around with Photoshop, and sharing my knowledge with everyone.


  1. I’m already using this technique to cloak my affiliate links but I just wanted to reiterate that every blogger should be doing this. I definitely noticed an increase in the amount of clicks on my affiliate links after doing this so it’s definitely worth the little bit of effort that it takes to set it up.

  2. Cloaking affiliate links is completely new to me. I’m going to use this on my own blog. Thanks.

    • You really should be cloaking your affiliate links. I think you’ll notice a big improvement in the amount of people clicking your links as well as buying the products you’re selling.

  3. I use to stay away from affiliate links like the plague. Those links had me going all over the place. I learned that some people make fake websites with malicious behaviors and use fake affiliate links. Now having affiliate links myself I definitely see the value in cloaking the affiliate links. This process is a lot easier than I thought. I was wondering is there a substitute or simple scripts for non-WordPress websites?

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=""> <strike> <strong>

CommentLuv badge