How to Cloak Affiliate Links in WordPress?

Are you searching for a guide to cloak affiliate links in WordPress? If yes then here we are going to look after different methods to mask ugly affiliate links to clean URLs.

In this tutorial, you are going to learn

  • Why cloak affiliate links?
  • How to mask affiliate links?
  • Plugins to cloak ugly referral links.
  • 301, 302, 307 redirects.
How to Cloak Affiliate Link in WordPress

Why Cloak Affiliate Links in WordPress?

There are several reasons to cloak affiliate links in WordPress and here is why…

1. You can convert ugly-looking affiliate links to a clean URL.

For example, I have an affiliate link of WP Rocket Caching Plugin like this https://shareasale.com/r.cfm?b=10665949&u=1518717&m=74778 so I mask this link to https://www.wplogout.com/wp-rocket. The link looks clean and now you can easily link it from your blog posts.

2. It is easier to manage affiliate links

Let’s say you have masked your affiliate links and have used that masked links in 100 articles so when you want to change the original affiliate link then you just have to change it in only one place rather than editing it into 100 posts which is time-saving & headache-free.

3. Saves a link from hijacking

Affiliate links are naked URLs with query string parameters so it easier for hackers to change URLs but cloaking helps to protect affiliate links from hijacking.

4. Tracking your affiliate performance

With the help of the cloaking plugin, you can track all the affiliate product performance from your WordPress interface i.e. you can track clicks per day or month.

Check Out: Create Free Amazon Affiliate Product Box using GenerateBlocks

How to Cloak Affiliate Links in WordPress?

If you want an easy solution for cloaking then you can use a plugin, even without a plugin you can simply do it in WordPress.

Here I am going to list out some of the popular plugins to cloak affiliate URLs easily.

Pretty Links – Personally, I am using a free version of Pretty Links which is more than enough for my requirements.

Thirsty Affiliates – Popular among bloggers and alternatives to Pretty Links.

Affiliate Links Lite – Alternative to both Pretty Links and Thirsty Affiliates.

Also, you can simply mask affiliate links without any plugin which is a bit time-consuming.

How to Cloak Affiliate Links with Pretty Links?

This tutorial is all about the free version of the plugin, if you are interested in upgrading it then it has come of cool features. (no affiliation with pretty links).

Pretty Links Pro Version
  • Auto-replace keywords throughout your site with Pretty Links.
  • Protect your affiliate links by using Cloaked Redirects.
  • Redirect based on a visitor’s location.
  • Auto-pretty link your Pages & Posts.
  • Find out what works and what doesn’t by split testing your links.

Step 1: Before setting up the plugin, let’s install the plugin first.

  • Go to your Dashboard > Plugins > Add New.
  • Type Pretty Links in the search box.
  • Install & Activate the plugin.
  • Now you will see Pretty Links Menu in your Dashboard area.

Step 2: Let’s explore the menu items within Pretty Links. This is all about free version so we are not going to

First let’s manage some Pretty Links Options Settings.

Pretty Links Options Settings
  • Links: For Redirection use 302 which is a temporary redirect, other than that you can use 301 and 307, check to Enable Tracking, Enable NoFollow options. Other settings under links are Enable Sponsored & Permalink Fix which you can enable or disable according to your requirements.
  • Reporting: Under Tracking Style use Normal Tracking, Other settings are Excluded IP Addresses, Auto-Trim Clicks, Filter Robots, use these settings wisely.

Step 3: Add New Pretty Link

Add New Pretty Links

Under Add New option,

  • Name your Title for Affiliate
  • Use 302 as Redirection,
  • Paste your unmasked affiliate URL in Target URL
  • Now insert your keyword in the Pretty Link box
  • Note is an optional field.

Step 4: Use Pretty Links in your Posts/Pages.

Now it is easier to remember and use affiliate links with pretty links. Now, you can select the desired text as anchor text to insert pretty links.

Step 5: Now look for extra Pretty Links Settings

  • Pretty Links: In this menu option, you can see all the created pretty links, it comes in handy when you want to edit, delete, track clicks, etc.
  • Clicks: In this area, you can track clicks, which links are clicked, which IP is accessing your URLs, etc.
  • Tools: In this option, you can use Bookmarklet, Trim clicks to clear your clicks from the database, etc.

How to Cloak Affiliate Links without a Plugin?

If you are familiar with the .htaccess file then you can easily cloak your affiliate URLs. It is a simple and easy process but be careful while accessing & editing the htaccess file, your site may be inaccessible.

Step 1: Access and edit the htaccess file. There are different ways to access it, One way is using an FTP program like Filezilla, another way is using the File Manager plugin in WordPress. Also, If you are using SEO plugin like Yoast or Rank Math then you can easily edit it from your WordPress Dashboard.

Step 2: Note: There may be other code in the htaccess file too, so don’t delete those codes. Also, make sure you have already a backup file for htaccess. Now Edit your htaccess file. Here we are going to use 302 HTTP code for temporary redirects.

Follow the following format, here go is the keywords, you can replace it with keywords like i, recommends, etc.

#Affiliate Redirect Code Format
Redirect 302 /go/[YourAffiliteKeyword] YourOriginalAffiliateLink

For Example: Let’s say I have wprocket as my affiliate Keyword in my htaccess file then I will have to mask the affiliate links in the format listed below.

#Affiliate Redirect Example
Redirect 302 /go/wprocket https://shareasale.com/r.cfm?b=1075949&u=1518717&m=74778
htaccess affiliate redirect method -cloak affiliate links in WordPress

Step 3: Hit Save Changes and follow the step 4.

Step 4: Now, go to your content where want to place affiliate links. Insert the link in the format as https://yoursitename.com/go/YourAffiliateKeyword

Frequently Asked Questions

Should I use nofollow in affiliate links while Cloaking?

Yes, it is good practice to use a nofollow link relationship in your affiliate links while cloaking.

Which is the best plugin in WordPress to mask affiliate links?

As mentioned above Pretty Links, Thirsty Affiliate, Affiliate Links Lite, etc are the best plugins in WordPress to mask affiliate URLs.

Should I use words like ‘i’, ‘go’, or ‘recommends’ word in my affiliate links?

You may use words like i, go, or recommends or you can directly skip these words to mask your affiliate links.

Can I mask affiliate links without a plugin?

Yes, you can mask affiliate links using different manual methods, one of the popular methods is to redirect via .htaccess.

Should I use 301, 302 or 307 for Affiliate Link Redirects?

301 is a permanent redirect HTTP code whereas 302 and 307 are temporary redirect HTTP codes. It is recommended to use 302 redirects to mask the affiliate links.

Recommended Reading: Add Reusable Block in WordPress

At the End

Are you using any manual method to mask links? if not which plugin are you using?

I generally prefer to use a plugin for this method since it comes in handy and has many advantages over the manual method.

I hope after reading this tutorial, you will able to cloak affiliate links in WordPress easily. If you know better plugins than mentioned above then you can share them below in the comment section.

Share:

GET 100+ FREE SEO TOOLS

Quickly access over 100+ popular SEO/Marketing tools to Boost your website traffic.

Thank you for subscribing. Check your Email(Didn't receive? check Spam Folder)

Something went wrong.

I am obsessed with WordPress and write articles about WordPress Speed Optimization, SEO, Blogging. I mostly publish tutorials on GeneratePress and GenerateBlocks.

2 thoughts on “How to Cloak Affiliate Links in WordPress?”

  1. How can we remove the author name or user name URL below the title in the free generatepress theme? For eg.
    Published On: June 17, 2021 by Suraj Katwal

    Here At Suraj Katwal, you don’t have any link.

    Reply

Leave a Comment