How To Cloak Affiliate Links Manually Using PHP Redirect

By on August 8, 2012

Internet marketers and bloggers live and breathe affiliate links, weaving them into their content here and there, trying to make them look appealing. The best way to make your affiliate links looks good is to cloak them. This means that instead of having ugly links with all the tracking numbers exposed, you can cloak affiliate links manually using PHP redirect. Of course there are plugins that do this for you, like Ninja Affiliate ($1 trial at the moment) or Thirsty Affiliates.. They are both great plugins but if you like doing things yourself then creating PHP redirects is not that hard.

Cloak Affiliate Links Manually Using PHP Redirect

To cloak affiliate links manually using PHP redirect you will need access to your server. This is only possible if you have your own paid for web hosting and will not work on free blogs.

1. Logon to your server. Go into the root of your domain.

2. Create a new folder. Name it as you want the link to appear. For example, if you want the link to be tips4pc.com/PcMatic then you would call the folder PcMatic.

3. You can also put the PcMatic folder in another folder like tips4pc.com/go/PcMatic. This just means you make a folder named GO in the root, then go into that folder and make another folder called PcMatic.This way you do not have to overcrowd your root domain with new folders. You can put all of the affiliate folders into one neat folder.

4. When you are in the PcMatic folder, click on the create file icon and name the new file index.php.

5. Paste the code shown below into the file and save it. Make sure you replace my affiliate link with yours.

<?php
header( ‘Location: http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=Mitzpantic-’ ) ;
?>

Video – How to Cloak Affiliate Links Manually

It is much better to cloak your affiliate links because here is a perfect example why:

Uncloaked Link: http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=Mitzpantic-

Cloaked Link: http://letsbuildwebsites.com/Hostgator

About Mitz

My name is Milica Pantic but everyone calls me Mitz. I am addicted to internet marketing and making money online. Who wouldn't want to live that life? I started out with one website as a hobby and now have over 20. Building websites and making money online is not that hard. You have to actually take action to make money...that is the biggest hurdle! :)

47 Comments

  1. Frin

    November 7, 2012 at 8:59 am

    I actually use custom affiliate links and they don’t look too bad on my blog so I don’t really have much of an issue with this.

  2. Alicia

    October 5, 2012 at 12:43 am

    Thanks for sharing with us this handy tip. Looks really easy. It is nice to know that we can cloak links without using a plugin!
    Alicia recently posted..Jigoshop eCommerce Plugin Review

  3. Suzie

    September 25, 2012 at 3:39 pm

    Hello,

    Interisting post. For WordPress I’m using now the “Redirection”, just search for it in the plugin install box and you’ll find it. It also logs everything, which is also nice for your click stats…
    Suzie recently posted..Vodafone V1415 (dofollow)

  4. Erik

    September 24, 2012 at 8:32 pm

    Hello,

    I followed your directions exactly, however when I try to go to the link at the end i’m getting this error message on the website:

    Parse error: syntax error, unexpected ‘:’ in /home/madupz/public_html/recommends/index.php on line 2

    What do you think the problem is?

    Thanks,

    • mitz

      September 26, 2012 at 5:27 am

      Just doublecheck the url which is your link and the actual code you pasted into the index.php. There must be an error.

  5. John K Lemieux

    September 6, 2012 at 11:23 am

    i use plugins when I work in wordpress, everything has a plugin for it. But its good to know we can do this manually.
    John K Lemieux recently posted..Eyes Slider

  6. Andy

    September 1, 2012 at 8:22 pm

    Hey Mitz,
    nice Idea – but what do you do when having 20, 50, or more Links ?
    what when you need to change / edit a link ?
    wouldn’t it be easier to use something like Ninja-Affiliate to get all links organized in a simple way ?
    Andy recently posted..5 Important Steps for homepage beginners

    • Mitz

      September 2, 2012 at 8:33 pm

      This is the same. You only edit one link and it changes all your previous redirects. Of course it is easy to use a plugin too! I try not to use too many plugins that your site will rely on. Especially when it comes to making money. I had a plugin I had to take out and it took me days to redo my links. While this was going on I lost sales.

  7. Vektor

    September 1, 2012 at 6:04 pm

    Firs thing i said when i saw your post title is “WOW”. I have been while searching everywhere to know how can i clock my affiliate links , and here you are guiding me. Thanks alot.

  8. Aswin Vayiravan

    August 21, 2012 at 5:23 pm

    Is this a fair marketing practice?People should not be conned!
    Affiliate links should be explicitly mentioned so that readers are fully aware of what they do!
    Aswin Vayiravan recently posted..The Best Communication, Work and Play Apps For The iPhone

    • mitz

      August 23, 2012 at 3:58 am

      This is exactly why i use the product name in the url so people know what link they are clicking on. It also says this in the article. it looks better than 3hdof333.395je.com ??? At least with a product name they know where the link will lead.

  9. kevin

    August 20, 2012 at 10:22 am

    hi Mitz.
    It is best idea. I have read this article, It is very informative. I like it.
    i will use the php code to my wordpress

  10. nick

    August 19, 2012 at 5:53 am

    I actually use custom affiliate links and they don’t look too bad on my blog so I don’t really have much of an issue with this.

  11. Jessica

    August 18, 2012 at 12:42 am

    Thanks for sharing this, Mitz – this is great! You are right, cloaked addresses look so much better than and I had actually been wondering if there was a way to change them. The video is super helpful!
    Jessica recently posted..Stepping Out: Soho House’s sophisticated little sister

  12. Stan

    August 17, 2012 at 12:27 pm

    Hi Mitz,
    PcMatic is a great tool and this video confirms it. Cloaked addresses look more user-friendly.

    • Mitz

      August 17, 2012 at 9:33 pm

      I agree Stan!! PCMatic is a great tool and cloaking looks better to the visitors. I also like to “nofollow” these links so google does not think there are pages that exist for these links.

  13. Richard

    August 17, 2012 at 11:19 am

    A nice little php trick that just works :)
    I can think of a few things to use this for.

    Thanks Mitz!

  14. Jean-Luc

    August 14, 2012 at 10:04 pm

    Thanks for the tip!
    I’m using the redirection plugin, which allows you to create a simple redirection
    It’s great, free and easy to use
    Jean-Luc recently posted..Patrimmo Commerce Bulletin Trimestriel T2 2012

  15. Aayna

    August 14, 2012 at 5:36 pm

    A great post Mitz! This post can provide a great help to those set of individuals who are quite new to the world of blogging. The video is worth watching. Cloaking the affiliate links is indeed a nice option. Thanks for sharing this valuable information.
    Aayna recently posted..Beat the Budget by Learning How to Sell Jewelry for Cash

  16. Andrei

    August 12, 2012 at 12:47 pm

    Good tutorial friend, now i’ve learn another trick for a little revenue. Keep posting.
    Andrei recently posted..Natural plants with antibiotic properties

  17. ysk

    August 12, 2012 at 11:33 am

    Thanks a lot for this tip. It’s definitely worth a try instead of a plugin.
    ysk recently posted..Rome blue

  18. John Will

    August 12, 2012 at 9:37 am

    Hi Mitz!
    Great article.I was looking to try it for my webiste and it’s really a big help.Now i think it would surely help me getting click on my affiliate links.

  19. Azam

    August 11, 2012 at 7:29 pm

    Hello Mitz I was really need such a remedy since long ago. You are really providing us a good guide line about web development.
    Azam recently posted..Silpada Designs National Conferences

  20. saju

    August 11, 2012 at 5:27 pm

    The only thing PHP,which is seems like very difficult to me,hope you will make some tutorials about it soon…..
    saju recently posted..Some Micro Freelancing Sites | Experience Not Needed

  21. John Smith

    August 11, 2012 at 10:00 am

    I was searching all over the internet for this PHP redirect and recovering my aff links and finally found it. Thanks bro!
    John Smith recently posted..Creatine Loading Phase

  22. Glen

    August 11, 2012 at 6:59 am

    Great video! I haven’t tried cloaking yet but it looks so easy that I would have to keep my hands busy of the weekend because of this! thanks!

  23. Dedicated PHP Programmer

    August 11, 2012 at 6:51 am

    Wow! Amazing post! Great use of PHP! I didn’t know about this before…Thanks for sharing!

  24. Friv

    August 11, 2012 at 4:24 am

    This is really great tutorial for cloaking the affiliate links manually. Thanks for share. So very Thanks.

  25. Greg

    August 10, 2012 at 10:57 pm

    Mitz, awesome tip!! So much better than using htaccess or link shorteners.

    Question regarding these links…any way to track when/number of clicks?

  26. SEO news

    August 10, 2012 at 4:45 pm

    Miz this post is really good, I was also having trouble with affiliate links and wanted to cloak as search engines especially Google is having problem with affiliate links. My site is built with WordPress and I finally get figured it out.

  27. Pavel

    August 10, 2012 at 1:26 pm

    This is a pretty neat way to mask affiliate links. I actually use custom affiliate links and they don’t look too bad on my blog so I don’t really have much of an issue with this. However if I start using other affiliate links I might need to cloak to make my blog look decent.

  28. Meka

    August 10, 2012 at 12:17 am

    oh that’s so smart
    the idea didn’t even come to my mind!
    thank you so much
    Meka recently posted..Why you lose a lot of money when you sell with Paypal Alone

  29. Vic

    August 9, 2012 at 8:45 pm

    I´m wondering if this is the solution I was looking for to get more clicks on my affiliate links!!! this tutorial has helped me do it manually…cheers mate

  30. Annetta Powell

    August 9, 2012 at 7:33 pm

    Hi Mitz,

    Found your blog through your guest post in comluv.

    I am not an affiliate marketer but mostly a network marketer. But I do affiliate marketing as well. Since I have several sites hosted in the same hosting account, if I do php redirect, is it going to screw up the other sites? I really don’t deal with the hosting account as I have someone managing it. I think I should go for the Ninja plugin to make it easier.
    Annetta Powell recently posted..Network Marketing Scams – Fact Check List

    • mitz

      August 10, 2012 at 12:17 am

      I agree the plugins make it easy also..but the redirects are placed in the root of the different domains so they wont mess with each other.

  31. Prakash

    August 9, 2012 at 7:00 pm

    This is really great tutorial for cloaking the affiliate links manually.
    Thanks Mitz for sharing it……….
    Prakash recently posted..Scarlett Johansson Hot Wallpapers

  32. Raj

    August 9, 2012 at 3:53 pm

    Hi Mitz,
    It is a nice article I have gone through ,I am not used cloaked Affiliate Links manually though I owned a web site design a web hosting site so far. But I will surely opt the guideline you have shown. Thanks again

  33. D.J. Maak

    August 9, 2012 at 7:39 am

    Hey Mitz,

    This is always a great thing to know and the method I prefer using for my links. I’ve never seen the point in investing in a plugin to do it when it’s pretty simple to do it by yourself. Also by doing it this way, you only ever have to change one link if your affiliate link changes rather than going through all your posts and changing all your links if you were to use affiliate links straight up.
    D.J. Maak recently posted..Michael Fiore Text Your Ex Back 2.0 System Launches (dofollow)

  34. Fatima Hipolito

    August 9, 2012 at 3:44 am

    Nice, you did great mitz, I will share this page to my friends so they will see it too…
    Fatima Hipolito recently posted..glock accessories sale

  35. Pavel

    August 8, 2012 at 9:37 pm

    A very useful trick! I was actually looking for a way to cloak affiliate links on my blog and I was considering getting the plug-ins to do this. I’ll try you way and see how it goes. Thanks for sharing Mitz!

  36. Shane Ryans

    August 8, 2012 at 8:53 pm

    Great work around. With all the updates it is getting hard to do things like this. Nice tutorial
    Shane Ryans recently posted..Why keyword negatives are important

  37. Nawaz

    August 8, 2012 at 3:11 pm

    Hi Mitlz

    Good tutorial but I think one should be master of PHP to get benefit from this tutorial.

  38. Simmeon

    August 8, 2012 at 12:34 pm

    Morning Mitz,

    I prefer a custom link for affilaite links, one the just look better and two if you use a plugin you can moniter the amount of clicks you are getting per link. Still nice and simple way using PHP which I’ll save for later.
    Simmeon recently posted..Overcoming My Fear – Failing, Doubts And Public Speaking (dofollow)

  39. Aditya

    August 8, 2012 at 12:07 pm

    Hey Mitz,What a timing Mitz…I have been looking for this from morning but couldn’t do cloaking,my developer ssaid he will soon find the solution but thanks to you.You are a savior :)
    Aditya recently posted..ERP Software India

  40. Jasmine

    August 8, 2012 at 7:31 am

    Good tips again, Mitz. Indeed, cloaking an affiliate like makes it shorter, more user friendly and definitely more clicks! Hooray, that means more sales! :)
    Jasmine recently posted..GreenGeeks CEO Interview (dofollow)

  41. Bhushan

    August 8, 2012 at 5:56 am

    Hey Mitz,
    Great post,
    video is too good on affiliate links so this determine a good theory for a bloggers special newbie are waiting for that.I appreciate this post.
    Bhushan
    Bhushan recently posted..School Management Software System (dofollow)

  42. Mike Howg

    August 8, 2012 at 4:45 am

    Thanks for the great article. I have been looking at doing this on my own blog so this is a really big help. Hopefully it gets more people to click on my affiliate links.
    Mike Howg recently posted..BlogPunch is a CommentLuv Enabled Blog

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

COMMENTING POLICY: We love RELEVANT and value adding comments here but we have rules. You MUST leave a REAL NAME in order to get your comment approved. IP addresses are tracked and compared so SPAMMING for a link building will not work on this site. Comments like "nice post" will not be approved.