How to Cloak Your Affiliate Links
Have you ever visited a landing page and thought "holy hell, those affiliate links are just painfully obvious!" ? Well, I have. So I thought I'd create a post to let you know how to cloak your links so they at least aren't so obvious.
Requirements
- PHP
- Apache
- Affiliate Link
Description
What you're going to do is create a couple of lines (if they don't exist already) in your .htaccess file. Then you're going to create a PHP file that the lines will point to and then you'll create your links. Easy as pie.
Step 1
Create a file called jump.php (located in your root web folder) and place the following code inside-
Step 2
Open or create and then open your .htaccess file (located in your root web folder). Once you have it open, place the following code inside-
Once you've done that, save the file to your website and close it.
Step 3
Wherever you'd like your cloaked affiliate links to be, you can code them like this:
<a href="/jump/growersflowers.com">GrowersFlowers.com</a>
o
<a href="/jump/christmas_trees">Christmas Trees</a>
And they will end up looking like this:
So there you go. Your links are cloaked and no one will be the wiser!
Good luck.
-Scott
Popularity: 34% [?]








December 25th, 2007 at 10:19 pm
Scott,
Can the .htaccess file be in the root of an addon domain?
Also, in Step 2, does < mean “<”?
Thanks!
December 25th, 2007 at 11:52 pm
@lhd333-
The .htaccess file affects both the directory its in as well as the subdirectories of that directory, so yes.
I updated the post to be clearer. Wordpress messes formatted code up, despite our best efforts.
Scott
December 26th, 2007 at 1:00 am
Thanks Scott! I’ll give it a shot!
December 26th, 2007 at 9:15 pm
Scott,
Finally figured it out - one more thing to add to help your audience.
For whatever reason, in the jump.php file, you cannot use hyphens (-), however, underscores (_) work.
Also, for clarification, if you are using an add-on domain, the jump.php file needs to be in the same folder as the page with the links on it.
Thanks again!
December 27th, 2007 at 12:51 am
@lhd333-
Thanks for pointing that out. I updated the code itself (.htaccess) to allow underscores as well as hyphens, so it should be fine now.
Yes, an addon domain can only access its own folder, so the jump.php would need to be in the same folder with that domain.
Scott
December 30th, 2007 at 1:04 am
[...] on three previous posts Why Use Tracking Code, How To Put Tracking Code On Your Landing Page and How To Cloak Your Affiliate Links, the intention of this post is to inform you on how to track the keyword someone used to get to [...]
December 30th, 2007 at 11:09 am
One more thing Scott:
Under my hosting, I have multiple addon domains. I put the htaccess code at the root level.
It works great for one of my addon domains (jump file is in the add on folder).
I tried to do the same thing for another addon domain, but it doesn’t seem to work. Any ideas?
Thanks!
February 2nd, 2008 at 8:10 pm
@lhd333: Wow, sorry for the delay. You did so for an addon domain?
You have to put it in the root folder of THAT domain. If you did so, it has to be something else.