How to Create a PHP Redirect for your Affiliate Link
If you do any sort of affiliate marketing it is worthwhile learning how to create a PHP Redirect for your affiliate links. If you are not sure what this is or how it benefits you read on!
Whenever you use an affiliate link in an email to your list, on your website, or in a blog post, it is best not to use the affiliate link in its raw form. For example, here is my affiliate link for Ebay:
Quite horrible isn’t it? Not only is it long, it is also very unprofessional looking.
One of the best ways to make this link look shorter and more professional is to create a PHP redirect. The link now looks like this:
Creating a PHP redirect link like this has a few big advantages:
1) Easier to keep your links up to date: If an affiliate program changes their link format (this happens a lot) I just need to update a single PHP file. Once I have done this all the links on my website, blog, EBooks and emailsare automatically up to date. This beats going through all my web pages trying to change hundreds of affiliate links.
2) Easier to deal with affiliate programs closing down: If an affiliate program closes, just update the PHP file and replace it with a similar affiliate program.
3) More Professional Links: As we discussed above, PHP redirect links are more professional looking compared to raw affiliate links.
4) Shorter Links: As discussed above a PHP redirect link is usually shorter than an affiliate link.
Now that you know the advantages of PHP redirect links, how do you go about creating one? Thankfully it is pretty easy to do this. Here are the steps for creating a PHP redirect file:
STEP ONE: Optional – create a new directory on your site to store all the redirects. I chose to create a directory called “recommends”.
STEP TWO: Create a file called myprogram.php where myprogram is the name of the program you are promoting (e.g. ebay.php in the above example).
STEP THREE: Open this file in a text editor such as notepad
STEP FOUR: Copy and paste the following exact text in the file:
<?php header("Location:http://www.youraffiliatelink.com"); exit(); ?>
STEP FIVE: Replace http://www.youraffiliatelink.com with the affiliate link that you are promoting. Important – do not remove the quotes around this link and do not remove the word Location: and do not add or remove spaces – only replace the URL and nothing else.
STEP SIX: Upload this file to your website
STEP SEVEN: If your file is called myprogram.php and you uploaded it to a directory called “recommends” your URL will be:
All done! Now every time you want to advertise that program on your website, blog, by email or external to your site, use this PHP redirect link.
- how to be an affiliate without redirect
Filed under: Affiliate Marketing
Like this post? Subscribe to my RSS feed and get loads more!