In this article, you will learn how to cloak affiliate links without plugins on a WordPress website using .htaccess redirection.
You will also learn why it is important to cloak affiliate links.
When you join an affiliate program as an affiliate, you are provided with a URL containing your unique referral code. This URL or affiliate link containing your referral code helps track your sales.
If you have heard the term cloaking for the first time and what it does, don't worry. This tutorial will help you easily cloak your affiliate links without using plugins.
Let's get started.
Note: This article contains affiliate links. When you click an affiliate link and make a purchase, we get a small compensation at no cost to you. See our Privacy Policy and Disclaimer for more info.
Why Should You Cloak Affiliate Link?
Affiliate link cloaking emerges as an important practice for crafting custom links for your audience. Doing this makes a short, memorable, and brandable link.
Thus, cloaking links entails the transformation of lengthy, ugly, and complex URL strings into manageable, trustworthy, and branded links.
Below, I have mentioned some key benefits of cloaking affiliate links.
Enhanced Trust and Click-Through Rates
Trust serves as the cornerstone of effective marketing. An affiliate link, once cloaked, looks more professional and credible.
https://shareasale.com/r.cfm?b=1320634&u=528889&urllink=&afftrack=
If you look at the above link, it looks long, ugly, and dirty. It needs more trust. Will your site visitors click such links? It is highly unlikely.
Whereas, if you shorten the link as shown below, your visitors are more likely to click on it.
https://technicalwall.com/go/wprocket
Thus, shortening the link makes it look more branded and trustworthy. It will result in higher CTR and conversion in terms of affiliate sales.
Prevention of Commission Theft
The straightforward construction of standard affiliate URLs can be an open invitation to unscrupulous entities aiming to hijack or overwrite your hard-earned commissions.
Thus, you need to prevent it by cloaking your affiliate link.
By cloaking links:
- You shield your rightful earnings from being usurped by affiliate link tampering.
- The complexity of the cloaked URL thwarts most attempts at commission interception, preserving your income.
Boost in SEO Efforts
Uncloaked affiliate links can be misconstrued by search engines as spam or dubious content, thereby:
Affiliate link cloaking ensures that these links are perceived as internal or valuable content-based links, contributing to:
What is Affiliate Link Cloaking?
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-
http://www.affiliatesite.com/products/AS9061YTNP/?ref=5522
We can shorten the above link by using link cloaking method to make it look like a branded URL as shown below-
http://www.yoursite.com/go/productname
http://www.yoursite.com/recommends/productname
http://www.yoursite.com/refer/productname
Benefits of Using Link Cloaking
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
- /recommended/
- /recommends/
To do this you will need to create a folder in your root directory.
Login to your cPanel and create a folder (select any one of the above example). For example, you can create a folder - 'go' under public_html folder.
Now your affiliate link will look like this-
https://yoursite.com/go/
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
https://shareasale.com/r.cfm?b=1320634&u=528889&urllink=&afftrack=
then, you need to create a related URL for the above affiliate link as shown below.
https://technicalwall.com/go/wpx
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.
Enable hidden files in File Manager
.htaccess file
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/?ref=8795747
In the above example, you can see that I have used 302 redirection and added my affiliate link prefix as /go/.
After the affiliate link prefix /go/, you're now required to add your destination (original) link.
Now, whenever a users clicks on my affiliate link - https://technicalwall.com/go/siteground, he will be redirected to the Siteground website. And, if he/she decides to purchase a hosting plan from Siteground, I would earn affiliate commission.
Please remember that you should not modify the existing entries of the .htaccess file otherwise you could get errors on your website.
That's it, this is how you can add short URL to replace the default long, ugly affiliate link provided by the affiliate network or program.
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. I will also advise you to take a complete backup of your website before you implement the above method.
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.
User-agent: *
Disallow: /go/
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? Yes, absolultely.
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.
Some affiliate program also provide option to cloak the affiliate link. You can cloak the link from the affiliate website itself.
For example, A2 Hosting affiliate program has such features.
If you are promoting affiliate products of A2 Hosting or are planning to join its affiliate program then you can use its AffLinkProtector option to cloak your affiliate link.
After login to A2 Hosting, 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.
AffLinkProtector
If you have not yet joined A2 Hosting affiliate program, join by visiting this link. Join A2 Hosting affiliate program and earn up to $125 per sale.
Frequently Asked Questions
Q1. What is affiliate link cloaking?
Answer. It is the process of disguising an affiliate link to make it appear short, more user-friendly, brandable, and aesthetically pleasing. This is often done to boost click-through rates and prevent link theft.
2. Why should I cloak affiliate links?
Answer. Cloaking affiliate links can make them appear more trustworthy and clickable. It also helps improve the user experience by making the links appear more natural within the content.
3. Is it necessary to cloak affiliate links in WordPress?
Answer. While it's not mandatory, cloaking affiliate links can enhance the appearance and credibility of the links on your WordPress site, potentially leading to higher conversion rates.
Q4. How can I cloak affiliate links in a WordPress site without a plugin?
Answer. You can cloak affiliate links in WordPress by combining custom redirects and HTML coding, and you can utilize your site's .htaccess file to manage redirection.
Q5. What are the potential benefits of cloaking affiliate links without a plugin?
Answer. Cloaking affiliate links without a plugin can reduce the reliance on additional software, improve site speed, and reduce the risk of plugin-related conflicts.
Q6. Are there any risks or downsides to cloaking affiliate links?
Answer. While it's generally safe to cloak affiliate links without a plugin, ensuring the redirection process is properly managed is important to avoid broken links or potential SEO issues. Also, you should fully back up your website before implementing this method to recover from accidental mistakes.
Q7. Are there any legal considerations when cloaking affiliate links?
Answer. In affiliate marketing, it's important to comply with FTC guidelines and disclose affiliate relationships, regardless of whether links are cloaked or not.
Wrapping Up
Cloaking your affiliate links contributes to a more professional and polished brand image.
Instead of displaying a string of numbers and symbols, cloaked links can incorporate your brand name or relevant keywords, reinforcing your brand identity and credibility.
I hope you found this tutorial on how to cloak affiliate links without plugin in WordPress helpful. If you've liked it, please share it with your friends on social media.
For more related blog articles and tutorials, please check out the below mentioned resources.
Nice article
Very nice article