Don't Miss An Update, Subscribe Now!

Click the RSS icon to the right to subscribe to our feed or sign up below to receive email alerts each time this blog is updated.
Affiliate Marketing RSS Feed

Using PHP to Redirect Affiliate Links

June 26th, 2008 Derek

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: 31% [?]

[Post to Twitter] 

Related Posts

Using .htaccess to Hide Affiliate Links

What Would YOU Like to See?

How to Direct Link With a Domain

Make Money Blogging with OIOPublisher!

Weekly Wrap Up

RSS feed | Trackback URI

10 Comments »

Comment by Christoph Subscribed to comments via email
2008-06-26 14:23:16

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.

Comment by Derek
2008-06-26 21:29:22

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.

 
 
Comment by Muneeb
2008-06-27 01:14:48

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

 
Comment by Vad Subscribed to comments via email
2008-06-27 04:06:44

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

 
Comment by John
2008-06-30 11:14:30

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.

 
Comment by Luke
2008-08-25 15:37:28

This is awesome – I’ve been trying to figure out how to do just this for weeks now; thanks so much!

 
Comment by Sara Subscribed to comments via email
2008-11-10 20:18:17

Hi

Do search engines, especially googlebot find such redirects and restricting sites because of it?

thanks

 
Comment by Jeremy Subscribed to comments via email
2008-12-30 02:22:30

@Sara

Word around the campfire is that this is actually a much better method than having your site direct link to the affiliate offer using your “affid=23423234″ blablabla link. I think the Googlebot frowns upon those links much more than these php redirect links.

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post