Cloaking Affiliate Links Without WordPress Plugin (Load Faster)

When you manually cloak your affiliate links without installing and using any WordPress plugins, your website performance will improve and load faster.

All you need to do is a few simple, easy steps, explained here in this article.

How to Cloak Your Affiliate Links Without Installing Any WordPress Plugin (Manual Way)

You can do so by quickly editing your .htaccess file. This is found inside your web hosting account, and you should use its File Manager to access it.

Here are the five (5) simple steps to do so.

Step 1: Decide on the URL Slug / Prefix

URL slug/prefix is the word you chose to distinguish easily that it is a link to an external website, typically an affiliate website.

Here are some of the URL slug/prefix examples;

You can choose your own URL slug/prefix.

Step 2: Use the File Manager from your Web Hosting


Log in to your web hosting account and navigate your File Manager menu.

If you are using WPX hosting, you can go to <My Services>, <WordPress Hosting>, click on your domain name and select <File Manager> on the left-hand menu. Then, confirm by clicking on <Open File Manager>.

Step 3. Go to the .htaccess file

Now you need to find the .htaccess file inside your web hosting account. In this example, we will be using a WPX hosting account.


If you have multiple domains (websites), click on <domains>, and you need to select the right one.

If you only have one (1) domain (website), then click on <public-html).


Double-click the <.htaccess> file to open it up.

Step 4: Edit the .htaccess file

You need to insert new codes into this .htaccess file.

## refers to comments I have written, and these words will not affect the file in any way. For example, I use ## to include the words AFFILIATE LINK URLs because it is easier for me to understand the next time I need to edit this file again.

The real codes start with <Redirect 302 ……. >


Redirect 302 /go/bluehost
Redirect 302 /go/wpxhosting
Redirect 302 /go/dreamhost

/go refers to the URL slug/prefix I have chosen, followed by the name of the affiliate brand/company. You can enter a short-form name or abbreviation if you wish.

Lastly, you need to provide the full (unique) affiliate link.

Step 5: Edit the robots.txt file

You need to disallow the rule on your robots.txt file to prevent Google from crawling, indexing, and following all your Redirects.

In Step 3, you will see the file <robots.txt>; double-click to access it.

Insert the disallow code as shown below.

User-agent: *
Disallow: /go/

Enter the URL slug/prefix of your own. /go/ is just an example here.

What are the Benefits of Affiliate Link Cloaking?

Here are reasons why cloaking affiliate links is better;

1. Easier to understand for visitors

In reality, the actual affiliate links are unique and lengthy URLs. This may confuse the visitors on where exactly the external link is heading. By cloaking it nicely, you can let your visitors see and understand them quickly.

2. Protect yourself from link theft

There are malicious malware and hacking activities out there that can steal bloggers’ affiliate commissions. The few unique ID characters in the URL are necessary to uniquely identify you as an affiliate marketer. If your webpage is compromised, the hacker can replace your affiliate ID with their own.

3. Easier to maintain when affiliate links get more

As content creators, your content may increase as time goes by. Having a neat and consistent naming for all your affiliate links is important for tracking and preventing errors. Affiliate links are very lengthy and are easier to misspell and mis-type.

4. Easier to share with others

Not all social media platforms can accommodate a lengthy URL. Twitter, for example, only accepts a maximum of 280 characters. When sharing your affiliate links in a neat cloaked URL, your links will not appear spammy and messy to others.

5. Easier Link Tracking

Using link tracking tools to analyse where your visitors are coming from, going out, session times, etc. It is very useful if you have a neat and organised affiliate link-cloaking process.

What’s more

Always use a “nofollow” attribute for all your affiliate links, as stated by Google’s guidelines.

In WordPress, when you insert a new link, you can right-click on it and select <Edit as HTML>.


Now you can insert the “nofollow” attribute into the raw HTML code.

See the example below. The bold text is the “nofollow” attribute.

<a href="" rel="nofollow">Google</a>

Leave a Comment

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