How To Hide An Affiliate Link With A PHP Redirect Script

I thought I would write this quick post about how to hide an affiliate link with a php redirect script because I wanted to use it on Pinterest and could not find any really complete instructions for it.  Well, not ones that technophobes could understand!

I’ve only just got into Pinterest after buying NonStoPinterest ( read more about that here) and I had heard that Pinterest has clamped down on marketers spamming it with their affiliate links. This is what happened when it first launched.

In fact, when I tried to add an affiliate link, I had cloaked with Pretty Link,  to my image to promote an  affiliate product the system would not allow it. I asked in the NonStoPinterest Facebook  group and Chris suggested I could try a redirect using a php script and gave me some brief instructions about how to do it.

It all sounded beyond me  but not to be beaten I decided to search the internet for some more detailed instructions. Most of the posts I found didn’t really explain it step-by-step in a simple enough fashion for me but after reading through quite a few blog posts and watching some videos demonstrating it I finally got it!  Eureka!

I thought that there must be others like me so here’s my blow -by -blow account of how to hide an affiliate link with a php redirect script. I hope it makes sense to you.

1. Get Your Affiliate Link

Firstly you need to get your affiliate link.

Just to give you an example we will take a Clickbank product called Fat Burning Furnace.

My affiliate link for that would be: http://a3502gjin0ru465oucr7wcrq4b.hop.clickbank.net/

2. Open Notepad

Now you need to open a blank page in Notepad or whatever you usually use that is similar.

Copy the basic script below and paste it into your notepad page making sure there is no other text on the page.

<?php
header( ‘Location: http://www.youraffiliatelink-goes-here.com’ ) ;
?>

Next you replace the “http://www.youraffiliatelink-goes-here.com”  with your affiliate link. Taking my example affiliate link above it would look like this:

<?php
header( ‘Location: http://a3502gjin0ru465oucr7wcrq4b.hop.clickbank.net/’ )
?>

3. Save the file as a php file.

To do this simply change the .txt file name at the bottom of the notepad page to .php

make money on the internet

 

 

 

Make sure you also change the Save as type to “all files” or it will end up being a .txt file

Make money online

 

 

 

You will probably want to name the file the same as the affiliate product you are promoting.

So in this example I would save it as:

FatBurningFurnace.php

Making money online

 

 

 

4.Upload the file

Upload the file to your hosting account either using ftp software such as FileZilla or upload directly in your c-panel.

Making money on the internet

 

 

 

Make sure you are in public html and upload to your root domain or the domain you want to use for this.

For this example I would use my detox specialist domain which is my root domain so I would upload it there.

The url you would use now for this redirect would be your domain name with the name of the php file. It would look like this:

http://www.yourdomain.com/name of file.php

In this example my URL would be:

http://www.thedetoxspecialist.com/FatBurningFurnace.php

5. Test your URL

Test your URL now to make sure it works.

When you send people to the  link you just created it should redirect to the affiliate product you are promoting.

You wouldn’t believe how happy I was when mine worked. It’s not really as complicated as it first appears.

This is not the only way you can hide and redirect affiliate links of course. I daresay I will get comments that will mention those but I  will stick to this method for the moment.

If you already use a good redirect method why not share it with my readers in the comments.

If you find this post useful please share it or like it. Thanks 🙂

15 thoughts on “How To Hide An Affiliate Link With A PHP Redirect Script”

  1. Hi Sandy – Thanks for another great post!
    Redirecting is not only used for affiliate links,as in SEO it is being used to redirect an old domain to a new domain (if for example, your old domain was penalized).

    In that case (and maybe also in affiliate links) it is better to add

    which uses the 301 message (permanent move) rather than the 302 HTTP message (temporary move).

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

  3. Sandy,

    You took a task that could leave a newbie pulling her hair out in frustration and instead made it do-able. Great post. I’ll be referring it to others.

    1. Hi Lydia,

      I’m all for doable! Thanks for referring it to others.

      I will be listing myself in your Online Business Women Directory.

      Sandy

  4. Thanks for sharing this. This really helps actually. I have been finding out recently on how to hide an affiliate link and there I found it here. Thanks!

  5. Great post, thanks sharing it,this really helps me. I’ll be referring it to others.
    Stan

  6. Hi Sandy,
    That’s a very brilliant discovery. I’ve never heard of that before although I’ve not been very serious with affiliate marketing.

    I’m sure this will help many affiliate marketers and of course it will be very handy when i will start being an active affiliate marketer which will be very soon. I’m sure i will be needing your help ones i start.

    Thanks for sharing Sandy.

    BTW: You have a very beautiful blog here and thanks for visiting my blog.

    1. Thanks for the compliments about my blog Theodore. I’m glad you might find this tip useful in the future when you start to do some affiliate marketing.
      Wishing you every success.

      Sandy

  7. Hi Sandy,

    I often time forget that I’ve learned so much. I learned how to do that a few years back and also wrote about it but I bet it’s been two years now. I still redirect my links this way too.

    Great job and I know it works well.

    ~Adrienne

  8. Thank you so much for the step by step instructions. I have had an online business for 12+ years and learned everything on my own. It’s so much easier when people, like yourself put it in terms that anyone can understand. I tend to rush instructions (usually to my wife lol) and she has to tell me to slow down…it’s easy when you have done it for years because YOU know how to do it, but you need to remember not everyone does know and might need simpler instructions. So thanks again!!

    1. Hey Ron,

      Good to see you visiting my blog. For some reason your comment ended up in my spam but I’ve rescued it!

      You are right. Once you have mastered something you wonder why you thought it so difficult it in the first place.

      Sandy

  9. wow!! great information…

    That’s a very brilliant discovery. I’ve never heard of that before although I’ve not been very serious with affiliate marketing.

    I’m sure this will help many affiliate marketers…

  10. Hi Sandy, great tips you got here. Thanks for sharing it to us. I really appreciate this work of yours. I never knew how to hide and affiliate link with a php redirect script until I read this. Keep up the great work! Thanks again for the ideas and tips!

Leave a Reply to Sandy Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.