Just a quick post to show you how I hide my affiliate links by using a PHP redirect. It's not the only way to do it but it's easy and helps to keep things organized...and hidden.
First step is to create a folder on the server to store your redirect files in. One way to create a folder on the server is though FTP. If you need to learn how to FTP, here is a quick FTP tutorial. I always create a folder called "go" but it can be anything. I've seen people use "recommends" or "jump" etc. but it doesn't matter a whole lot what it's called.
What we are doing here is adding our affiliate URL to a text file and saving it with an appropriate name. Then when we link to the file, which is on our server, it will redirect over to the affiliate offer, therefore keeping the actual URL hidden from prying eyes. For example, from this site I might have an affiliate link for GoDaddy. I would create a text file called godaddy.php with the appropriate code (the code is below) and put the file into my "go" folder. Now when I link to it from a post or page, I would link to http://keithjameslock.com/go/godaddy.php.
Tip: Be sure when including the link in a post that you use the full link with the http:// and domain name. If you were to use /go/godaddy.php for the link, it would work from the web site but it wouldn't work from your RSS feed. Using the full URL ensures that it'll work from any site your feed is displayed on (including your own).
PHP Redirect Code
Use the code below to setup your redirect. I always create a template file called redirect.php and when I need to create a new redirect I open up the file, change the affiliate URL and save it with the appropriate name and then upload it to the server.
Here's the code:
<?php
$redirecturl = 'AFFILIATE URL GOES HERE';
header('location: '.$redirecturl);
?>
You should probably prevent the redirect folder, in this case "go", from being crawled by search engines. If you aren't sure what I mean, the next post will be covering it.
Related posts:
- Keeping Affiliate Links Organized
- Forget Traditional Link Cloaking, Make Your Affiliate Links DIRECT Links
- RE: WordPress MU – I can’t get any links to open in a new window (even if that option is selected). Do you think it’s a theme or installation issue?
- Instructions To Quickly Self-Upgrade To php5 For GoDaddy Users
- Zend Optimizer Error for Syndicate Kahuna on GoDaddy













Enter your first name and email address below to receive exclusive money making tips.

.jpg)





One Response to “PHP Redirects And Hiding Affiliate Links”
Trackbacks/Pingbacks
[...] ← PHP Redirects And Hiding Affiliate Links [...]