In the last post, I talked about using .htaccess to hide and redirect your affiliate links. In this post I want to give you another example of a free way that you can do this only this time using php instead of .htaccess.
I’m sure you’ve seen this method used over and over on make money online blogs and probably never noticed it, or if you have, you haven’t implemented it on your site or blog even though it’s extremely easy to do! This post will show you exactly how to go about redirecting affiliate links or any other type of link using php. This allows you to link to an affiliate offer multiple times yet if you ever need to change the offer, you’d only have to open up one file and change the url in that file.
If you hovered over a link using this method, you’d most likely see a URL that looks like this…
http://www.clickconsultants.com/goto/wordze.php
or
http://www.clickconsultants.com/recommend/wordze.php
So let’s explain how this works. The first thing you need to do is log into the FTP of your site and create a folder. You can give this folder the name goto, recommend, or whatever else you may feel works well for your site.
The next step is to open up notepad or any other simple text editor and add the following code to it.
<?php
header( 'Location: http://www.youraffiliateurl.com/' ) ;
?>
You would of course replace www.youraffiliateurl.com with the actual site or affiliate offer that you want. Next, you simply save this file using whatever name you want that would describe it. For example, I could link to Wordze and save the file as wordze.php
Next, upload the file into the folder your created above. You know have a link which would look something like this.
http://www.clickconsultants.com/goto/wordze.php
You can then use this link in all your articles, landing pages, etc and if you ever need to change the affiliate url, you would simply open up the wordze.php file and change the link, thus, allowing you to change the link across your entire site instantly.
Popularity: 28% [?]


June 26th, 2008








If you use this method within PPC campaigns you are revealing your referring keywords to the merchant or network. An html meta-refresh would be better as it will help to keep your keywords secret.
This is a debate I’ve heard forever, well for teh last 2 years that I’ve been in affiliate marketing, and whether or not it actually does I couldn’t tell you.
What I can tell you however, is that I’ve been using these methods for redirecting for the last two years and it has worked fine for me. I’ve never had a problem with networks competing with me or stealing my keywords.
My advice…don’t work with shady networks and you don’t have a problem.
That was really informative, i was looking for the same thing for weeks now, i thought i would have to go for some lessons to do that but its damn Easy hehehe
Thanks for the great help !
Cheers
Hi Derek,
thanks for the advise!
The question is what URL should be on the aff product when I use this method explained above?
http://www.mysite/redirection-folder/file-where-php-code-with-the-aff-URL
That is the URL should I use?
Thanks,
Vad
As said, not a safe way to redirect. Php header is not changing the refering headers so they can see where your visitor was before they were redirected. So if you are sending some shady traffic or just don’t trust your affiliate manager, use meta refresh.
This is awesome - I’ve been trying to figure out how to do just this for weeks now; thanks so much!
Hi
Do search engines, especially googlebot find such redirects and restricting sites because of it?
thanks