Link cloaking using PHP Redirect file

August 21, 2007
By

In this post I went over the cool free link cloaking script by Andy Fletcher. For those who don’t want to use a script you can easily cloak your links using a PHP re-direct file.

You don’t have to know squat about PHP programming since it’s just three lines of code and all you need to do is enter the affiliate link you want to cloak.

Here is the code:

<?php
header(“Location: http://www.affiliate-link-here.com”);
?>

All you need to do is open up notepad, copy and paste the code above into your text editor like notepad then save it as a php file and upload it to your server. When you link to that file, they’ll be redirected to your affiliate link.

It will only take you a few minutes to cloak your links following the steps above.

Here is a video tutorial I shot which walks you through the process.

YouTube Preview Image


Keep In Touch!

Get the latest updates, news, tips, reviews, podcasts, interviews, & more. Don't worry, I won't hammer you with crap emails...

15 Responses to Link cloaking using PHP Redirect file

  1. Edy on January 24, 2008 at 10:04 am

    Hi Alan

    Thanks for cloaking affiliate tips.
    This tips helps me a lot to hide my affiliate links.

  2. Robert Nelson on January 31, 2008 at 6:11 pm

    Do you have to have a different link cloak for each affiliate program you want to use?

  3. Alan on February 2, 2008 at 2:50 pm

    Hi Robert,

    Yes, I cloak all my affiliate links. I’m now using a WordPress plugin called Simple Link Manager which is awesome. It’s not for sale yet but if you’re Teli Adlam’s customer you can get the SLM plugin for free.

  4. Edy on February 3, 2008 at 4:55 pm

    Hi Alan

    Do you cloak affiliate links from cj?
    Which method do you use to cloack cj’s aff link?

  5. Robert Nelson on February 4, 2008 at 3:48 pm

    In spite of the fact that she no longer sells Optiniche. It is great if you have purchased Optiniche as she has always coming up with something that makes blogging easier.I consider it one of my better purchases. So yes I have obtained SLM and am wending my way through it.

  6. Alan on February 4, 2008 at 9:34 pm

    Hi Edy,

    Yes, I cloak all my affiliate links including CJ. It won’t include the 1×1 tracking image but (in my opinion)you don’t need it.

  7. Alan on February 4, 2008 at 9:35 pm

    I agree Robert. I purchased Optiniche almost two years ago and it’s on my best purchases. Teli is amazing.

  8. Edy on February 4, 2008 at 10:29 pm

    Alan, cj links contain url and image. When I choose individual product and get the html code. Cj said that I must include all the code including image source to track properly.
    I still confuse how to cloak cj’s link.
    Right now I am using freelinkcloaker from andy. And I can’t cloak cj’s link using freelinkcloaker. Is it possible to use php redirect to cloak cj’s link?

  9. [...] left an excellent question in the php re-direction post comments.  I was going to respond via the comments section but my [...]

  10. Alan on February 5, 2008 at 1:54 am

    Hi Edy,

    My response was getting too large and this is a great topic so I wrote it’s own post about it:

    http://www.imnirvana.com/affiliate-link-cloaking-cj-links-with-php-re-direct-file

    I hope that clarifies things a bit.

  11. kumar on May 17, 2009 at 5:22 am

    Where will the php file will go in the server. Thanks

  12. Alan on May 20, 2009 at 10:01 am

    On your server create a new directory by creating a new folder–call it whatever you want but popular choices include: “Recommends”, “Like”, and “Go”. Once you’ve created your directory for example “Recommends” put your files in that folder and the redirection will work. And your URL will look like this: yoursitename.com/Recommends/productname

  13. John on February 8, 2011 at 2:48 pm

    Whatever I do, the redirect code will not work.

    I have created the php file in Dreamweaver. Then, in the Notepad. Removed the arguments, and tried the root domain ( .net vs .net/?affiliate=, etc)

    Never works, but just shows the code on the page, and complaints about errors on the line with the header function.
    Any suggestions?

    Thanks in advance.

  14. Alan on February 8, 2011 at 3:04 pm

    I’m not sure what you mean with removing the arguments. Here is what to do…

    1. open notepad

    2. paste in the code:
    < ?php
    header(“Location: URL”);
    ?>

    3. Replace “URL” with the full url (doesn’t matter if it’s .com, .net, .info, etc.)

    4. Save the text file as “index.php”

    5. Create a directory in your hosting account called “recommends” or whatever you want to name it.

    6. Inside the “recommends” directory create a directory using the SEO friendly naming convention of the link. For example: “product_name”

    7. FTP the text fie you created “index.php” into the “recommends/product_name” directory.

    That’s it. Now when someone clicks on yoururl.com/recommends/product_name they will be redirected to the URL in the index.php file. Make sure you don’t have any spaces or missing anything from the code since even a blank space can create a problem.

  15. Peter Murphy on April 7, 2011 at 3:39 pm

    Thank you so much for the step by step guide you provided in response to a question by one of your readers (no name attached to the post).

    I had the same problem and had followed instructions to the letter even watching your video on how to do it tons of times but the re-direction link won’t work…. not untill I saved the script as index.php

    Everyone says save it as .php but nobody mentioned the index bit. I have to say though that i have seen files saved as .php and has worked. I have even saved a php redirect file like that in the past and it worked. That is why I was so baffled that it does not work for me this time.

    I don’t understand these things very much but all i know is my redirection is working fine now with index.php

    May be you could explain why .php works sometimes for some people and other times you have to save with index.php.

    In any case thanks. I have wasted a whole day on this but was determined to find the solution. In the end my patience paid off by discovering your website.

    Keep up the good work

    Peter
    (struggling online but will succeed)

Leave a Reply

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

*

CommentLuv badge

 Subscribe to My Newsletter 

Keep in touch…

Meet me in Twitterland

Lets Get Social

Follow Alan Petersen on TwitterJoin My You Tube ChannelAlan Petersen on Facebook
Subscribe via RSSSubscribe via FeedburnerInternet Marketing Podcast

Recommended…

Buy ScreenFlow 2