This tutorial will tell you how to mask your affiliate links so they don’t look like affiliate links. Why would you want to do that? Well the simple reason is that you want to gain more trust from your users. They are more likely to click a link that points to a page inside your own site than some random link to an external site. Besides, affiliate links can look very sketchy.
You can use various plugins to cloak your links in WordPress. But in this simple tutorial, we will tell you how to do it without using any plugin. This method allows you to easily change affiliate links by editing one file, instead of going through every page on your site where you placed a particular affiliate link. You just have to change one file and every page is now changed to reflect your new link address.
Here is an example of an affiliate link:
http://www.jdoqocy.com/t775hz74z6MOTRWOQRMONQTQOUP
A visitor to your site would be more likely to click this link instead:
http://www.yoursite.com/go/merchant.php
The second link will allow you to still point the visitor toward the first link, but will make the entire process much more professional and safe from the visitors’ point of view.
There are many premium scripts that will do this, as well as some free WordPress plugins as well. I prefer to use the below method because it is really easy and I know that the visitor is going through my link and I am not depending on a script to get the job done.
How to cloak affiliate links using PHP
The first step will be to create a .php template file. You can do this in notepad or any code editor. I usually just call it merchant.php.
You will simply paste this code into that page, replacing the affiliate-link with your link.
<?php header('Location: affiliate-link'); ?>
Here is how the file would look with the above affiliate link inside it.
<?php header('Location: http://www.jdoqocy.com/t775hz74z6MOTRWOQRMONQTQOUP'); ?>
You would choose “Save as” and rename the file with whatever name you want to give to the merchant or product you are promoting.
Then place this file on your web server. I usually place the file in a “go” folder, so that I can simply drop the files in there as I add more affiliate links.
Then I will simply link to that file every time I wanted to send the visitor to that affiliate merchant or product:
http://www.yoursite.com/go/merchant.php
Now wasn’t that real easy? Sorry to disappoint you if you expected a lengthy tutorial. Enjoy cloaking and have a great day!