In this article you will learn how to cloak affiliate links in a WordPress site without any plugin using .htaccess redirection.
We will also learn why should we cloak our affiliate links and how to do it.
Many bloggers monetize their blogs by recommending affiliate products of different companies. This is called affiliate marketing.
Affiliate marketing is one of the best way to earn passive income. It is done mainly by placing affiliate links in different parts of our blog such as sidebar or blog content or footer.
Now the question arises what is the need of cloaking affiliate link and what are the best method of doing it.
If you have heard this term cloaking for the first time and what it does, don't worry.
In this article I will tell you in detail what is cloaking and how to cloak affiliate links in a WordPress site without any plugin. We will use a different technique other than the WordPress plugins to cloak affiliate links.
So, how we are going to achieve this. We will cloak affiliate links using .htaccess redirection.
Let's learn more about it in detail in the next section.
Why Should You Cloak Affiliate Link in Your Blog or Website?
Every day thousands of blogs are launched around the world. With increase in number of blogs competition in affiliate marketing has also increased to a great extent. Every bloggers wants to beat competition and succeed in affiliate marketing.
For achieving success many people resorts to different malpractices to steal off your affiliate sales. Many competitors hire companies which through malware tries to replace your unique affiliate links with their own link and earn commissions causing loss to you.
We can tackle these problem by using a technique called Link Cloaking.
What is Affiliate Link Cloaking in WordPress?
Link cloaking is a technique used for shortening long affiliate links. Usually affiliate links are long and ugly to look. By shortening affiliate link by cloaking it looks branded and also results in higher Click-Through-Rate (CTR).
See this example.
A traditional affiliate link look like this-
We can shorten the above link by using link cloaking method to make it look like a branded URL as shown below-
Benefits of Using Link Cloaking
- As mentioned above link cloaking shortens the affiliate link and the link looks more branded to your user. Users are now more likely to click on this branded URL instead of long affiliate link thereby increasing the click-through rate (CTR).
- By using link cloaking it becomes difficult for anyone to use malware to replace your unique affiliate link. Thus, you preserve your commission.
- Now you can easily manage all your affiliate links by placing all of them under one folder.
- If you actively promote your affiliate campaign by sending emails to your users then it would be wise to cloak your affiliate link in order to land your mails in inbox folder instead of spam folder.
How to Cloak Affiliate Links using .htaccess redirection?
STEP 1: Decide on your uRL slug
You can use any of these URL slug, for example, /affiliate/, /go/, /refer/, /out/ or /recommend/
To do this you will need to create a folder in your root directory. Just login to your cPanel and create a folder (select any one of the above example), for example, 'go' under public_html folder.
Now your affiliate link will look like this-
STEP 2: Prepare Related URL
In this step you will need to compile a list of related URL for all your affiliate links.
For example, if your affiliate link is-
Now you need to create related URL for above affiliate link as shown below-
Repeat the same process for all of your affiliate links.
STEP 3: Modify .htaccess File
In this step we will have to modify the .htaccess file which is located under public_html folder.
If you are not seeing it then it might be possible that the file is kept hidden by default.
You can see the hidden .htaccess file by selecting Settings in File Manager.
Here, you have to select the check box with the option Show Hidden Files (dotfiles). See the image given below.
Note: Whenever you modify the .htaccess file always make it a habit to keep a copy of it at a safe place in case something goes wrong.
Now open the .htaccess file and add all the affiliate links as shown below-
## AFFILIATE LINK URLs ##
Redirect 302 /go/bluehost http://www.bluehost.com/track/technicalwall/
Redirect 302 /go/siteground https://shareasale.com/r.cfm?b=9421871&u=610873&urllink=&afftrack=
Redirect 302 /go/mythemeshop https://mythemeshop.com/themes/
... existing entries (do not modify it)
What is a 302 redirect?
A 302 status code is commonly referred to as “temporarily moved.” This redirect doesn’t carry or pass the link value to the new URL. What it does do is redirect your site visitors into another web page temporarily.
STEP 4: modify robot.txt file
In this step you will need to prevent Google from indexing your cloaked URLs. To do this we will need to modify the robot.txt file.
If you are using Yoast SEO plugin in your site, then go to SEO >> Tools and select File editor. Here you can modify the robot.txt file. Add the following line in robot.txt file.
Now let's move on to the FINAL step.
STEP 5: Add Cloaked URL
In the final step you will need to replace your affiliate URLs with the newly created cloaked URLs.
Find all the affiliate URLs in your blog posts and replaced it with cloaked URLs one by one.
Should I nofollow affiliate links?
If you are not adding nofollow to your affiliate links then you are doing a big mistake by leaking link juice to the affiliate product you are promoting.
Thus, you must also add rel=”nofollow” to prevent leaking PageRank to the affiliate advertiser.
It will take time if you have many blog posts but once done it will worth your time.
This manual process of cloaking affiliate link is very robust and fast unlike WordPress plugins which does the similar work but may slow down your website.
This is an awesome method to cloak affiliate links.
Some affiliate program also provide option to cloak the affiliate link. You can cloak the link from the affiliate website itself.
For example, A2hosting affiliate program has such features. If you are promoting affiliate products of A2hosting or are planning to join its affiliate program then you can use its AffLinkProtector option to cloak your affiliate link.
After login to A2hosting, under Advanced Ad Tools select AffLinkProtector. Now, enter the affiliate URL you want to protect under URL to protect / cloak and select HTML under Redirection type. Now select Generate.
On selecting Generate, a web page will download. Save this web page to your computer. Now upload it to your own website. Now, instead of using your normal affiliate code, you can reference your uploaded affiliate web page, and no one can strip off your affiliate ID.
See the image below.
If you have not yet joined A2hosting affiliate program, join by visiting this link-
So, at the end of this article I am confident that now you know answer to the following questions-
- What is affiliate link cloaking?
- Why should you cloak affiliate links?
- How to cloak affiliate links for free without any plugin in a WordPress site?
I hope you liked this article. If you have any question or suggestion please comment below.
you may also like
It would be awesome if you share this article on Facebook, WhatsApp or Twitter below. Thanks.
Disclosure: This page may contain affiliate links, meaning that if you click on one of these links and purchase an item, we may receive a commission at no additional cost to you. For more information, see my disclosures here.