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

by Steve Scott | Join Him On Facebook

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: http://XXXXXX.nobsoffers.hop.clickbank.net, will now look like this: http://yourblog.com/recommends/nobsoffers. 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 http://optimacbid.nobsoffers.hop.clickbank.net 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 http://optima-lifestyle.com/recommends/nobsaffiliatemarketing

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.


Murray Lunn

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?

Cristina Ansbjerg


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 😀


Wayne Lambert

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. 🙂

Cristina Ansbjerg

Hi Wayne,

this is just a simple redirect. But it’s a good idea to include a piece of code to track stats.
My php knowledge doesn’t go so far though.



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?

Cristina Ansbjerg

Good point Brankica.
I’ve been trying to find out how to avoid that. So far, nobody has given me a good answer.


Kate Brown Wilson

The only thing I know about cloak is to hide your own affiliate link to prevent others from stealing it. very effective way or strategy of all internet marketers.

Cristina Ansbjerg

Thanks for your comment Kate.


Wordpress.org 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?

Cristina Ansbjerg


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.


Ming Jong Tey

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.


Cristina Ansbjerg

I totally agree. Tracking is keypoint. It’s the only way to really know how your business is performing.


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 http://example.com

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)

Cristina Ansbjerg

That’s another good option, Andy.



Paul Salmon

This is the method I prefer as I like creating one line rather than a directory and a file.

Many people, however, may not feel comfortable editing the .htaccess file, so the method outlined in this post is probably the preferred way for some.

Cristina Ansbjerg

You’re right. Whenever I tell people you can edit the .htaccess file they feel afraid or something like that.

Matthew Needham

I might have missed something here, can’t you just use something like PrettyLink to get the same effect?

Cristina Ansbjerg


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 😀


Barry Wells

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.


Cristina Ansbjerg

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 😉


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.


Cristina Ansbjerg

Thank you Adrienne!

For sure it seems more time consuming than it is. It’s actually very easy.



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.

Cristina Ansbjerg

Hi Thomas,

Like any link, you can make these links nofollow. That’s not a problem.

Thanks for your comment.



I just use GoCodes’ WordPress plugin. It lets you set /go/’s super-easily. Works a charm.


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!

Cristina Ansbjerg

Thanks Richard

Josh Kotsay

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.

Alan Ishibashi

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.


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!

Cristina Ansbjerg

Hi Christie,

It’s always a good idea not to rely much on plugins.


Michael | BuildinganOnline.com

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=”http://XXXXXX.nobsoffers.hop.clickbank.net” alt=”.” width=”1″ height=”1″ border=”0″/] (The brackets must be replaced with “”)

Thank you for an informative article 🙂


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.

Cristina Ansbjerg

Thank you for your comment Janet! I hope this short tutorial helps you to protect your commissions 😀



Thanks for showing the php code as well. That’s a big help for someone that isn’t a programmer.

Cristina Ansbjerg

Thank you Paul. It’s a tutorial for normal people without any technical knowledge. Almost everybody can follow it 😀

Duy Nguyen

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.


Cristina Ansbjerg

You can use this technique with any kind of link, Amazon too, since all you are doing is redirecting it.
Thanks for your comment!


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?

Cristina Ansbjerg


it’s quite easy to steal a commission. When someone reads your article and finds an affiliate link they can see it is something like this:

Your affiliate ID is exposed. Anybody can simply cut it from the link and go directly to http://dogtips.net
Or the thief can replace your ID with his own ID (they even develop adware/spyware to do it)



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.


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.

Yogendra Sharma

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. 🙂


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 on this entry are closed.

Previous post:

Next post: