Quantcast

February 3, 2012

How to Cloak Your Affiliate Links the Easy Way

I used to cloak my links the old-fashioned way, using simple HTML redirects.

The html page would be coded as follows:

<html>
<head>
<title>YOUR PAGE TITLE</title>

<meta http-equiv=”refresh” content=”0;url=http://YOUR AFFILIATE URL”>
</head>
<body>
<p>Redirecting, please wait. If you’re not redirected within a couple of seconds, click here:<br />
<a href=”http://YOUR AFFILIATE URL”>PRODUCT NAME</a>

</p>
</body>
</html>

The contents of the page would appear like this:

If you are not redirected within a couple of seconds, click here:

PRODUCT NAME

PHP:

Then I moved to using PHP redirects, one page for each affiliate link, such as the following which would would have been linked from http://yourdomain.com/recommends/affiliatelink1.php

Here is the code used to that page:

<?php
header( 'Location: http://affiliatelink1.com' ) ;
?>

Nowadays, I use a much simpler technique that puts all my affiliate links on one php page, i.e. link.php, which resides in the root directory.

<?php

$path = array(
‘affiliatelink1′ =>  ‘http://affiliatelink1.com’,
‘affiliatelink2′ =>  ‘http://affiliatelink1.com’,
‘affiliatelink3′ =>  ‘http://affiliatelink1.com’,

);

if (array_key_exists($_GET['id'], $path))
header(‘Location: ‘ .$path[$_GET['id']]);
?>

To make the links work, you must add the following to your .htaccess file:

RewriteEngine On
RewriteRule ^go/([/_0-9a-zA-Z-]+)$ link.php?id=$1

The links are then called using the following linking format:

http://yourdomain.com/go/affiliatelink1

Note, you don’t have to create a ‘go’ folder and you may call it anything you like, i.e. recommends, go, links… whatever.

For example, if youed want to use ‘links’ rather than ‘go’, then change ^go/ to ^links/

And that’s how to cloak your affiliate links the easy way!

Comments, questions or suggestions? Please leave a comment below!

Cheers,

sig-ros
About Rosalind Gardner

Rosalind Gardner is a blogger, speaker and Internet Marketing consultant, best known for her "Super Affiliate Handbook", (referred to by industry professionals as the 'bible' of affiliate marketing) and Rosalind Gardner's Academy - a multi-media version of the book.

Disclosure: We are compensated for our reviews. Click here for details.

Comments

  1. Thanks for the tips I always wondered how to cloak my affiliate links correctly. Great tips I am gonna implement them into my affiliate marketing campaign.

  2. Alex Newell says:

    Not being a techie I’m always grateful for this kind of post. I’m still using my old link cloaker which is a bit quicker than manually creating pages.

    All The Best

    Al

  3. Vicky Lewy says:

    Hi Rosalind,

    Thank you for share, however why you don’t use some of WordPress plugins for redirection? For example I use Redirection plugin http://urbangiraffe.com/plugins/redirection/ and it works great. I think it’s more convenient to use a plugin, especially for people who don’t familiar with php.

    Best wishes,
    Vicky

  4. Leo S. says:

    May be not so easy as it seems, for some (or many) of us.

    Could be interesting stuff for a more extensive article…

    Anyhow, it keeps us ‘on track’.

    Thank you!

    P.S. Everything alright with you puppy?

  5. bw says:

    Many internet companies do not allow affiliates to use redirect pages. Why is that?

  6. Andy Kong says:

    Hi, Ros!
    Thanks for sharing!
    As for me, those affiliate links of mine that I cloak, I make use of the service provided by:
    http://www.tinyurl.com
    What do you think of this method of cloaking affiliate links?

  7. Ken says:

    Hi Rosalind,

    I like the new cloaking method you suggest. The PHP redirect I think works well when you only have a few affiliate links, but having to create a page for each affiliate link is a bit time consuming.

    I also use the Pretty Links WP Plugin. All the links are on one page and simply adding the original affiliate link is needed to create the cloaked link.

    Are you familiar with Pretty Link and what are your thoughts on it?

    Thanks,

    Ken

  8. Jake says:

    Funny, I followed a similar path on my “affiliate redirect journey”. I remember a webmaster clued me in to that “keep it all in 1 file” method, and then when I eventually started coding in PHP, I began implementing that idea.

    One can also take this further if necessary, such as doing any security checks within that 1 master PHP redirect file, choosing 301 vs 302 redirects, email notifications, IP/bot blocking, etc. Yeah, all geeky stuff with possible applications depending on circumstances. But, the basic strategy itself works fine for most people and is a lot “cleaner” than an HTML meta-refresh.

    -Jake

  9. chris says:

    Thks for your tips!You’re great

  10. Marcus says:

    Is affiliate link cloaking away to protect your links from link theft?

    • Patch says:

      @Marcus,
      Absolutely! If someone sees the affiliate link in the address bar (before clicking on it) they can replace your affiliate id with another one, and you will lose the sale. This is especially true with clickbank A-ids because they are easy to spot. So you have to make sure that your redirect and also cloak it so it doesn’t appear.

  11. Hi Rosalind.
    I use a simple html redirect at first but i find the php redirect is much better.
    Or you can use bit.ly , offto.net or similar software to hide your affiliate links.(never use .tk ).

  12. Patch says:

    I learned how to use a small text file that contains a redirect script and my affiliate link that I name whatever I want and save in my root directory. This cloaks the url but I have to create a text file for each link. Now I am considering purchasing Powerlink Generator because it also allows you to keep track of all the other affiliate information in one place as well (affiliate login, password, commission, etc.) Has anyone used this program?

  13. Hey Rosalind,

    I use the html version my self but these other ways give far better looking links.

    Great post will be using the php redirects anymore

    Thanks

    Glyn

  14. Rick Faulise says:

    Thanks for sharing this info! This tip has just saved me a ton of effort and helps organize my affiliate links in one place. I appreciate you taking the time to make this info available.

  15. Steve Cotterell says:

    Hi Ros

    I love this idea , and will be implementing it straight away! Thanks for the great tip!

    Steve

  16. Lydia says:

    It is just what I have been looking for :)
    I have tried it and its working great!
    Thanks a lot!

    Lydia

  17. Gerri says:

    I have been putting up a page for each redirect and had wondered if there was a way of having them all on one page. You have just made my life that much easier. Thank you so much!!

  18. Mick McCrory says:

    Hi Rosalind, very good information. I’ve been using pretty link for about 4 months now, and it’s great. It’s a WP plugin, and it displays all of my affiliates on one page and tracks every click and unique click. I love it.

  19. Thanks. I was looking for a way to cloak my links from for affiliate products. This is quick and easy. All the best, Buddy

  20. I’ve never cloaked my affiliate links before, is it really necessary?
    How much do you benefit from it?

  21. Ryan Mill says:

    Good Tips.

  22. Simon Croft says:

    Hey Ros,

    Never did understand the whole affiliate cloaking stuff. Looks so easy when shown like that. Will have to give it a try.

    Thanks for sharing

    Simon

  23. Jonathan says:

    Why not just use the GoCodes plugin for WordPress? Works like a charm, and very easy.

  24. Sheralyn says:

    Cool… Thanks for sharing…

  25. chris says:

    Thanx for sharing, im a complete newbie to affiliate marketing i follow some of what your saying, i will have to look more deeply into it, thank you

Speak Your Mind

*