Using PHP to Redirect Affiliate Links

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.

Comments

  1. Christoph says:

    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.

  2. Derek says:

    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.

  3. Muneeb says:

    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

  4. Vad says:

    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

  5. John says:

    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.

  6. Luke says:

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

  7. Sara says:

    Hi

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

    thanks

  8. Jeremy says:

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

  9. Grant says:

    If you use a php redirect and then below the redirect include the tracking pixel will it still work?

    </body

  10. Excellent content Derek. Subscribed!

Trackbacks

  1. Hit a wall so heres some Buzz – or when all else fails link out…

    OK, I’m going to admit it, I’ve hit a wall. I’ve tried SO hard over the past few months to keep up with my business and blogging no matter what, but when devastating health issues
    ……

  2. Share Results Blog » Blog Archive » Differences Between CPA and CPC Affiliate Mindsets says:

    [...] these posts on using .htaccess to hide affiliate links and using PHP to redirect affiliate links from the Click Consultants blog. Simply put, they outline ways that affiliates can conceal their [...]

  3. [...] will require you to create a folder in your File Manager of your hosting, and redirecting your link to the affiliate site by using PHP. [...]

Speak Your Mind

*