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.
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:
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 sure you also change the Save as type to “all files” or it will end up being a .txt file
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:
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.
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:
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