Stop Commission Theft! (How to Manually Cloak Affiliate Links)

Cloaked FigureRecently I decided to limit the number of guest posts on my site.  But this is the first time I specifically ASKED for an article.

The other day Cristina Ansbjerg of Optima Lifestyle left a great comment about how to cloak affiliate links.

I feel this is a majorly important technique that every affiliate marketer should learn.  That’s why I practically begged Cristina to write a quick tutorial.  And here’s what she’s come up with…

A few weeks ago Steve posted a very useful article about How to Bypass an Opt In Page.

He created a video to explain very easily how to cloak your affiliate links using a free tool, G-Lock Affiliate Link Cloaker.

This topic is extremely important for affiliate marketers since cloaking your links is a technique you can use to:

  • Protect your commissions from theft. It’s quite easy to remove your affiliate code from the link and add in someone else’s. This way, that person would get your commissions. Cloaking the link, you won’t disclose your affiliate ID, therefore it can’t be changed.
  • Bypass a poor converting opt-in page
  • Give a better look to the ugly and long affiliate links. Also, your customer doesn’t have the feeling they are leaving your website.

Besides the free G-Link affiliate link cloaker, there are other premium plugins in the market. You can also use a URL shortener (e.g. bitly, TinyUrl).

But all these solutions have something in common: they are external. What would happen if for some reason you need to uninstall the plugin?

In this post I’m going to give you another option. I’m going to explain how to manually cloak your links. This way you will have total control over your links.

How to Manually Cloak Affiliate Links

What are we going to do?

We are going to simply redirect the affiliate links through our blog.

A link that looks like this:, will now look like this: Note that the final destination is not going to change.

For example, if I was promoting Steve Scott’s product “Affiliate Marketing without the Bulls**t” in my blog, Optima-Lifestyle, my affiliate link would turn into

*(Note: optimacbid is not my actual Clickbank ID. It’s just made to illustrate this post)

What do you need to cloak links manually?

All you need is:

  • A text editor (e.g. Notepad if you are a PC user)
  • FTP Client (e.g. Filezilla is free)

Let’s start!


Open your text editor and paste this simple piece of code:


Header(“Location: YOURAFFILIATELINK”);


(Important: Don’t leave any space after ?>

That would break the php code).


Change YOURAFFILATELINK for your actual affiliate link. The one you want to cloak. In my example, the piece of code would look like this:


Create a folder on your desktop called recommends


Inside the Recommends folder, create another folder. Give it a name that allows you to identify the affiliate product. Don’t use capital letters.

I’m going to call mine nobsaffiliatemarketing


Go back to the notepad and save the text file you’ve created in this new folder. The text file has to be called index.php (Always. No exception. Don’t try to call it anything different)

recommends —> nobsaffiliatemarketing —> index.php

Let me insert a short explanation here:

Every time you cloak a new link you will have to save it in the recommends file and then in the specific folder. For example, imagine that now I want to cloak my affiliate link for Hostgator as well. All I would have to do is repeat the previous steps -this time with my Hostgator affiliate link- and then save the text file as index.php in a folder called hostgator inside the recommends folder.

My recommends folder would look like this:


Once the recommends folder is ready, all we have to do is upload it to the root of our server using Filezilla (or any other FTP client).

(The root of your server is usually called public_html or httpdocs)

I’ve included a picture (please ignore that Filezilla is in Spanish)


Check carefully that the index.php files are named like that and not index.php.txt

If they’re not correct, simply delete .txt


Voilà! Your affiliate links are now cloaked. To be sure that you’ve done everything right, simply type the url into your web browser and press enter.

Let’s check if mine works

We can also try using an anchor text: Steve Scott’s Affiliate Marketing without B.S.

This system is very useful if at some point you want to change an affiliate link that you’ve used many times in different places (e.g. many posts on you blog).

In that case you only have to change the link saved on your recommends folder. With one simple change you control all the redirections for that link.

A big thanks for Cristina for creating this step-by-step tutorial.  To learn more about her, I recommend you go check out her site which covers personal development for entrepreneurs.

Take Action. Get Results.

44 thoughts on “Stop Commission Theft! (How to Manually Cloak Affiliate Links)”

  1. Hey Cristina,

    Thanks for bringing this up; I’ve been having some low conversions with some of my affiliates as of late and I think this may be one of the problems – mainly that the opt-in page doesn’t seem to convert as well as it should.

    I’ve been using prettylink (wp plugin) to do my affiliate links which also does tracking but this looks like it could be even more robust because who knows if prettylink doesn’t skim a bit off the top as well, ya know?

    • Murray,

      cloaking your links this way you control the whole process.
      I don’t trust plugins. If one day the plugin stops working, it’s no longer updated or you need to deactivate it because it’s in conflict with your WP you would have to start cloaking all the links again.

      I’m glad you find this tutorial useful 😀


  2. Hi Steve,

    This is similar to the PHP redirect code that I used except the code that I use also inserts the tracking stats into a MySQL database table which I can simply access by going to a URL.

    I’m not a tech dude but I did find someone for $5 who was willing to create my first affiliate link code and the MySQL database in my hosting account.

    $5 will go a loooooong way sometimes. 🙂

  3. I have nothing to add. this is exactly what I needed, especially that I was wondering all the time, seeing Steve’s pretty links 🙂

    I do have a question… When I do click on the link and the page opens I still see the affiliate Username at the end of the link. I guess there is no way around that?

  4. does not allow redirects in plugins they host for download, so you are forced with ‘plan b’. This is an easy and effective cloak and redirect. Do you have any thoughts regarding tracking?

    • Morris,

      On a previous comment Wayne Lambert said you can change the code to include tracking. I haven’t done it personally but I will definitely research about it. It’s very important.


  5. Simple yet effective way to cloak your affiliate link. I used to adopt this php method but now I am using Adtrackz to cloak and track link. I found that tracking is one of the most important activity to get a overall performance of my technique and I can decide if I should do anything difference.


  6. If your site is hosted on an Apache-based server (many are) you could also achieve a similar effect by editing your .htaccess file and including redirects. That way, you don’t even have to create folders and subfolders on your server, and if for some reason you don’t want to use PHP you don’t have to.

    You could do it via commands such as
    Redirect 301 /relative/path/to/folder

    Again this is just a one-line replace if you change your mind and want to link to something else.

    @Brankica: I believe there is also a way using this method not to change the original URL in the browser window, but I can’t remember the method right now. Also, it may only work when both files on on your local server (ie not redirecting to an external web site, which this is)

    • Matthew,

      like we said, there are many ways to cloak your links. This is how to manually redirect them. Pretty link is a plugin.
      You can use the one that suits your needs better 😀


  7. Hey Steve, my second visit and second time of being impressed….. looking forward to the 3rd, 4th etc 😉

    Hi Christina,
    Thank you for making this so easy to follow. I really like your method and have tried doing this before but the instructions I followed at the time were really hard to understand. I created one link for the product being promoted, the instructions came with that product, but when I tried to follow the same instruction for another product it went totally wrong.

    I then started using software that i have on my PC and also put them into a recommended folder but the cloaked links have .html on the end. Which still work but don’t look as clean or crisp as your demonstrate here.

    Excellent, Thanks Christina.


  8. Thanks Barry. I’m glad you find it easy to follow. That was my main concern. To provide an easy explanation because the process itself is very easy once you try.

    Btw, I agree with you. Steve’s content is always impressing 😉

  9. Great post Cristina,

    I’m thrilled to say that I learned how to do this some time back and shot a video walking people through how to set this up as well. Was thrilled when I learned this and although some people may think it’s a little time consuming, trust me, it only takes a couple of minutes once you have it down.

    So happy you shared these tips with Steve’s readers. I can tell from the comments that this post is a big hit.


  10. Sorry if I missed this in the comments section, but is there a problem with using a basic (permanent) redirect? Make the redirected page nofollow just so the search engines don’t think you’re pulling any funny stuff. At any rate this method feels simple and does cloak affiliate link effectively.

  11. I’ve got prettylinks for this purpose. But it’s great to know about how to do it manually as well in case the plugin stops working. Thanks for this tip!

  12. I think Andy mentioned this above, but I if I couldn’t use a plugin, I would prefer adding redirects via my .htaccess file. I think it’s just much simpler to do, and you would have all your redirects in one place for easier modification.

  13. At first I was like, uh-oh, this ain’t as easy as installing plugins. Then I went thru the actually steps and it is SO EASY I’m now thinking of dropping Pretty Links.

    I hate plugins crowding up my WP Admin — putting themselves in menus all over the place! This sounds like a great solution, and it’s nice to have full control over something.

  14. Awesome! I never knew there was a manual way to do it. I don’t trust a lot of the plugins either, the less I have the better. Thanks for the info, I’ll have to try this out!

  15. An other great way to “cloak” your affiliate links if simply to drop a cookie.

    Using your example from above, it could be done as this:

    [img src=”” alt=”.” width=”1″ height=”1″ border=”0″/] (The brackets must be replaced with “”)

    Thank you for an informative article 🙂

  16. Cristina, aloha. Thanks so much for this easy-to-follow tutorial on cloaking. As it happens, the timing of your post is excellent for me because I wanted to experiment with a few items from clickbank, however, I kept hearing horror stories of stolen commissions. Since I am a complete non-techie, I had no idea what, if anything, I could do to protect my link.

    Also, Christina, I appreciated your comment about learning to do it manually instead of relying on a plugin. That makes perfect sense.

    Wishing you a terrific week ahead. Again, thx for so generously sharing your knowledge. Aloha. Janet

    P.S. Steve, thanks so much for asking Cristina to share her knowledge with your readers.

  17. Thanks Cristina and Steve for this great technique 😀

    I usually used the tool my vendor offers when I worked with Clickbank some times ago. And I always am on the way to find out this technique and now I have it! Although I have turned to Amazon Associate recently but I think this one is still applicable as you know, Amazon affiliate links are the worst links on Earth lol!

    Thanks again and have a nice day.


  18. hmm.. I just realize that my commision can get steal by someone.. I’m noob in this internet marketing area.. So my question is, How do someone steal it?

  19. hi STEVE SCOTT, you have made nice points on how to increase traffic and how to decrease bounce rate. decreasing bounce rate method is beautiful. i like the blog promotion plan very very much, so i bookmark this page for blog promotion websites.

  20. Hi, this is a good option instead of using a plugin, although it will result to a 302 redirect. If you want to make it a 301 redirect, add header(“HTTP/1.1 301 Moved Permanently”); before header(“Location: YOURAFFILIATELINK”); – plus, make header and exit lowercase to make sure they are compatible with PHP later versions.

  21. You’re amazing man! I read the whole post and now I’ve a great idea to start a new affiliate blogging blog. I hope so it would make a big cash if get successful. Thanks Steve. 🙂

  22. Hello Steve & Cristina,

    Your information regarding link cloaking is very useful to me as I am a newbie. I have a question in my mind that I would like to cloak page for order then it is necessary to save page as index.php or order.php .

    Please guide me. Thanks.

Comments are closed.