How To: Hide Your Affiliate Links on WordPress
August 25th, 2007
There is no doubt that if you are interested in using your blog to make money online, it is important that you take advantage of the income potential that is available through the use of affiliate links. You can generate additional income in a variety of ways depending on the service, ranging from set payments for each qualified referral, to making a percentage of any referrals income for an established period of time.
There are many different theories covering the most optimal ways to display your affiliate links, but the most common ones involve a variety of methods for hiding your affiliate links. The idea behind using this theory is that readers will click on it thinking it is an internal link on your site, rather than taking you to a third party site. But, as we found out yesterday, there is an additional benefit! When all your website’s links point toward an internal address on your domain, you can control and update the URL easily. This helps avoid dead links whenever a company changes a URL and makes it easy to update your affiliate links when the need arises.
As for setting this up, it is actually pretty easy if you have a self-hosted WordPress blog. Here are the steps I took when I hid my affiliate links for this website:
- Create a folder called “Go.”
- Create a .php document (this can easily be done with Notepad) and name it after the appropriate affiliate link you are using. Now paste the following code into the document:
<? header("Location: http://youraffiliatelinkurlhere"); ?>
Save it into the “Go” folder created above.- Repeat steps 2-3 until you’ve created a .php file for each affiliate link.
- Go to your FTP and upload your “Go” folder directly to the public_html folder.
- Update all your affiliate links to point towards your new redirect!
Your redirect will look something like http://www.yourdomainname.com/go/phpdocumentname.php.
There are other ways to do this, such as not using PHP or altering your .htaccess file, but this is how I created mine. Any questions? Feel free to post them below!










Kyle,
For people that have cPanel hosting (like yourself) you can easily just create redirect instructions there. Quickly and easily plug in a URL of your choice, and then add the affiliate link where you want the redirection to go.
Take a look at my site and you will see what I am talking about. Check out my Text-Link-Ads redirection.
Talk to you soon,
Garry Conn
I have created a WP plugin for myself which allows you to do this easily, the only problem is that I haven’t had time to release it yet. If you see the banner clicks on my site they all go through my internal sites and I can view those clicks in the admin panel.
Once I get done with the other things on hand I will release the plugin to open public, with enhancements to add links to the plugin from within the write page and track it rather than going to the options page and creating it.
Lots more features like this but maybe will release it next week.
Thanks for the tip, that’s ridiculously simple actually. One of those things where you kick yourself for not thinking of it already
Garry – Thanks for sharing an alternate method. As I mentioned in my post, there are actually a lot of different ways to do this, but I was just sharing how I got mine to work.
Keith – You keep coming up with great plugin ideas! I look forward to seeing this one released for public consumption.
MB Web – No problem! Glad you found it useful.
Hi,
How about using .htaccess to redirect 302 (temp) pages to affiliate links ?
Kyle, I did everything as you told me, but what what I get when I click the link is the following wording: “The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.”
could you help me fix the problem? I double triple and super checked everything to make I didnt make any mistakes, but still the problem didnt go away.
Thanks,
White Al
Where do I place the “go” folder?