In last post we told you that this link cloaking is done by two methods. So, if you don’t want to install more plugins then you can cloak your links using .htaccess file. This method is very easy and here we will guide you to do the same.
As we all know that .htaccess file is very important in WordPress and using this file we can easily cloak affiliate links. To know how; follow given below steps.
How to Cloak your Affiliate links in WordPress without plugins
First all you have to decide URL slug for affiliate links like /refer/, /go/, /recommend/, etc.
First of make list of all the affiliate links which you are using on your site and choose related URL name
http://example.com/refer/bluehost for URL http://www.affiliatesite.com/r.cfm?b=874093&u=309572&m=61094&urllink=&afftrack=
http://example.com/refer/hostgator for http://www.affiliatesite.com/r.cfm?b=389512&u=984512&m=27845&urllink=&afftrack=
In your base directory under public_html folder .htaccess file is located, so open it. Here we have to make some changes, so before make changes copy this file for safety
Now update this file with below content. Just add this to file and don’t delete anything
## AFFILIATE LINKS ##
Redirect 302 /refer/bluehost http://www.affiliatesite.com/r.cfm?b=874093&u=309572&m=61094&urllink=&afftrack=
Redirect 302 /refer/hostgator http://www.affiliatesite.com/r.cfm?b=389512&u=984512&m=27845&urllink=&afftrack=
continue with all links
Here we are using 302 redirection which is also known as temporary redirect. This can be placed if you want to redirect visitors to another page and then planning to bring redirected page back after some time to your page.
Now open robots.txt file and add disallow all refer URLs and for that add this line
NOTE: Here in place of /refer/ you have to use the same word which you have selected in step 1 for URL slug
NOTE: Make sure that you have to make all affiliate links no follow and for that you have to add rel=”nofollow” after each and every link
So this is how you can cloak your affiliate links in WordPress without WordPress plugins. If you found this info helpful, then kindly share this with others also. Also comment us and share your views.