How to Cloak Affiliate Links?

Today we’re going to show you an easy and bulletproof way of masking affiliate links.

There are two possible ways how one can do it:

  • Via installing a plugin.
  • Via editing .htaccess file

The first option is quite easy and can be done in just a few minutes, while the second one requires FTP access and more precision of yours.


Let’s Start

What’s a link (masking) cloaking? It’s a method of turning long and ugly affiliate links into shorter and branded.

This means that something like this:

http://someaffiliatewebsite.com/product/productid?aff=your.affiliate.id

...can be transformed into this:

http://yourwebsite.com/refer/productname


Why Cloak Links?

  • You’ll be able to track clicks thus understand how much money those clicks have made.
  • You’ll be able to protect your links from hijacking (yes, there are people who can do it)ю

The Plugin Method

Among all affiliate cloaking plugins, we’re going to choose the ThirstyAffiliates plugin. It’s super-easy to use and with its help, you’ll be able to transform all your ugly affiliate links into user-friendly ones.

  1. Enter your WordPress website admin panel
  2. Go to the plugins section, hit Add new
  3. Into the search type in the name of the plugin ThirstyAffiliates

  1. Hit Install Now
  2. Inside your dashboard a new menu item will appear

  1. Hover Affiliate Links menu item and click Add New
  2. Affiliate link editor will load

  1. Now you need to add link name and the UPR itself, don’t forget to tick Open this link in new window?

  1. Hit Save Link, and your user-friendly URL is ready.

Just copy and paste it where it was.

.htaccess Method

In case you’re the kind of a person who’s not following some easy ways, an .htaccess method is for you.

Affiliate link cloaking via .htaccess method is executed via 302 temporary redirect, your redirected page will still retain its PageRank, MozRank, Page Authority.

What You Need to Do?

  1. First of all you need to choose the URL slug, we’re going to use the same as in the ThirstyAffiliates plugin - /recommends/
  2. Make a list of your affiliate links.
  3. Open your .htaccess file. It’s located in the public_html folder (don’t forget to back it up before editing, just in case).
  4. Now update your .htaccess file with following lines:

## AFFILIATE LINKS ##

Redirect 302 /recommends/your-affiliate-name http://your-ugly-affiliate-url.com/?ref=your.affiliate.id


Please note: this is an example you need to replace values your-affilite-name, http://your-ugly-affiliate-url.com/?ref=your.affiliate.id via your real affiliate name, and your affiliate link.

  1. Now you need to open your robots.txt file and disallow all /recommends/ URLs. You can find this file in your root folder. If there is none you need to create one.Create a new tex file and name it robots.txt into the file you need to add following line:

User-agent: *

Disallow: /recommends/


That’s it.


So What’s the Difference Between These Two Methods?

.htaccess redirection is a bit faster than thу one ThirstyAffiliates plugin offers. But still, it’s a bit longer to complete. Anyways it’s up to you to decide which method to use.

Stay in touch, more awesome hacks are coming.



Alex Bulat

Writing a blog post or building a micro niche WordPress website is something Alex can do bare-handed. You're welcome to contact him via Telegram, Facebook, or LinkedIn.

Get more to your email

Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.

From was successfully send!
Server error. Please, try again later.

Leave a Reply