How to cloak affiliate links in your WordPress blog?

Affiliate program can be a great source of online income for a WordPress blog as most of online products from various types do offer affiliate program for WordPress bloggers to join. We simply have to use the links that are given to us to promote the product.

Whoever who buy the products through the given links will make us entitle for commission from the owner of the online products. If we know the best way to market the products, affiliate program can provide us decent income for out WordPress blog besides advertising.

Link Cloaking – Do not lose any money again

One of the tips that you should know about affiliate marketing is link cloaking. Basically, instead of using the given links to hyperlink words or images, you ‘mask’ those links with another links.

The importance of this tip is it will ensure that your potential buyer does not remove your ID which sometimes can easily be taken out from the given affiliate links. Another reason is it will make the links look pretty instead of filled with a lot of weird characters.


to Online Classifieds WordPress Theme

For your information, there is always tendency for others, although not everybody to go straight to the online product’s website when those who are interested with the online products realised that we are using affiliate links. I also feel the same thing. How about you?

How can you cloak your affiliate link?

There are actually plenty of methods for you to cloak your affiliate links in your WordPress blog. The easiest method is through WordPress plugin such as Simple Link Cloaker and Affiliate Link Cloaker. However, through this method, it has the possibility to bring problems in future for example if the plugins are no longer been maintained by the developer.

In the end, the plugin may not be compatible with the latest version of WordPress. It will then affect the cloaked affiliate links in our old blog post as the links may probably will no longer working at that time.

Therefore, I will to give tutorial on simple way how can you cloak your affiliate links. The best part is this method will not affect your WordPress databases or systems and your .htaccess file. So, you will not have to worry as if something goes wrong, the worst thing that can happen is the cloaked links will not work. That’s all.

For your information, I learn this method from Keller Hawthorne from

The simple steps are:

1) Open Notepad program.

2) The write below code in the program




3) Then, save the file as index.php and make sure that for the ‘Save as type’ section, you choose ‘All Files’ instead of ‘Text Documents’. In order to make it easier for the next steps, it is advisable for you to save it in Desktop.

How to cloak affiliate link

4) You have to create a new folder in the new desktop to put in all of your index.php files as you have to create index.php file for any affiliate link you want to cloak.

5) However, to make the cloaked link to be more pretty like the one that I show you above, you have to create subfolder base on the category of the affiliate links. For example, for Huzzer Magazine, I make subfolder base on the developer of WordPress themes.

Example of the structure for the folder will be Recommends (main folder) > Templatic (subfolder) > eShop (sub-subfolder).

With this structure, you have to save the index.php file for the eShop theme under the ‘eShop folder’ and the links will look like

6) After you have dove all of the steps above, you just need to upload the ‘Recommends folder’ into your WordPress blog’s folder in your hosting. If there is only one website that you host in your hosting, you simply need to upload the folder into public_html folder.

If not, you have to look for folder that you install your WordPress blog. The folder will have a lot of .php files starting with ‘wp-‘ such wp-config.php and wp-register.php.

7) Then, after you have uploaded the folder, give it a try. Try to hyperlink any words in your WordPress blog and if you have properly followed the above steps, the link will bring you to the online products which you use its affiliate link in the Notepad just now.

If there is any error, please check back the link that you use and the spelling especially if there is any capital letter or ‘s’ at the end of your folders.

That’s all. Really simple right?

By the way, if you join new affiliate program in future, you just have to make new subfolder and upload it into the ‘Recommends folder’. You do not have to create another main folder again or to upload back all of the folders.

Which one do you prefer?

Which method of link cloaking that do you prefer? WordPress plugin or the method that I just taught you? For me, I prefer the above method as I find it more flexible and catchy as it is up to your creativity to make the cloaked links looks great.

What’s your say?

18 Responses to How to cloak affiliate links in your WordPress blog?

  1. Cosmin says:

    Why on Earth would you want to do it this way?

    Imagine having a blog with lots of affiliate links – this would be suicide.

    Anyway, to answer your question, I prefer Shorty (

  2. Elvin says:

    Using Plugins might ease the whole process. I also notice that some people are using shorturl or tinyurl instead, but not many people would be clicking shorturl or tinyurl.

  3. Helmi Asyraf (admin) says:

    Actually, it is not that suicidal as you have just need to create new subfolder each time you join new affiliate prgram. As for me, I do not join affiliate program all at once so the process still make sense for me.

    By the way, Shorty definitely has caught my attention. I never know about its existence before. Thank you Cosmin.

    I will definitely give it a try really soon. Cheers!

    Hope you enjoy Huzzer Magazine!

  4. Helmi Asyraf (admin) says:

    As I said before, plugin may cause some problem in future if it is no longer managed by developers as it may not compatible with the later version of the wordpress.

    Same thing goes to the the url shorterner service. What if the websites one day go down? I pretty sure it can cause us a lot of problem.

    By the way, the best way I think at the moment use the service as suggested by Cosmin above. Roughly, what I have seen is, it help us make the process that I taught above automatic and with better and easy to understand interface.

    Try it out!

  5. thanks for this great post on link cloaking ..Helmi and as said by elvin.. using Plugins might ease the whole process but using so many plugins will slow down the blog or can cause any problem in future!!! 🙂

  6. Vanessa says:

    I use the PrettyLink plugin. Works like a champ for cloaking links and giving me nice stats on where the clicks came from inside the admin panel.

    Otherwise, I like budurl for their tracking ability.

    I’ve got to be able to see stats on how popular the links are to know if my visitors like them or not, and if its not popular or I want to switch vendors, I can still use the same cloaked link.

  7. Helmi Asyraf (admin) says:

    Thank you for the information and suggestions. It is great to know more and more service that can provide pretty good link cloaking service.

  8. Elvin says:

    Helmi, when’s your next update?

  9. Helmi Asyraf (admin) says:

    Sorry for not updating this blog for quite some time. Btw, I have just published new post. Check it out k?

  10. Elvin says:

    Helmi, can I ask you about problems with wordpress?

  11. Helmi Asyraf (admin) says:

    Yes, sure. You can simply ask me through the contact form.

  12. Rodger says:

    I prefer your method which is virtually identical to the method I already used. Your correct about the plug-in; personally I think it’s too simple a task to justify creating a plug-in for. In essence, it’s just a few knowledgeable individuals taking advantage of newcomers by creating programs (and charging in some cases) to carry out a task that anyone could do.

  13. Is there any way i can use one of this plugins to claock the output of another plugin. The plugin I run right now outputs raw url. I want to convert that into better looking url. How can I do that?

  14. Fairoz says:

    Helmi, I have a problem with my wp blog and I find your post interesting but the social media panel on the left is irritating.

  15. Phil Mayer says:

    I think other web-site proprietors should take this website as an model, very clean and fantastic user genial style and design, as well as the content. You’re an expert in this topic!

  16. Pam says:

    I agree, the social media panel is extremely irritating!

    However, thank you for this helpful post. But, how do you check the link you’ve just created? You missed this one!

    If the developers of WordPress stop supporting it, will all our WordPress sites go kaput???

  17. php process is very hard.
    no alternate to plugin

  18. bhavin says:

    hello, good article but, your flying social networking links makes hard to read in 1024×786 resolution. i wish i can close it.

Leave a Reply

Your email address will not be published. Required fields are marked *