With the increasing popularity of using affiliate links to generate income online, it can significantly improve your conversion rate on affiliate sign-ups by disguising your affiliate links using a URL with your domain name, then redirecting them to the appropriate affiliate. 

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.  Another benefit is that all of your blog’s links point toward an internal address on your domain, giving you control to 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.

Redirects can be accomplished in a variety of ways, but as this blog focuses on self-hosted WordPress, I will be going over an easy way to do this using a PHP redirect.  Here are the steps I took when I hid my affiliate links for this website:

  1. Create a folder called “Go.”
  2. Create a .php document (this can easily be done with Notepad or any similar program) and name it after the appropriate affiliate link you are using.
  3. Now paste the following code into the document: <? header("Location: http://youraffiliatelinkurlhere"); ?>
  4. Hide Affiliate LinksSave it into the “Go” folder created above.
  5. Repeat steps 2-4 until you’ve created a .php file for each affiliate link.
  6. Go to your FTP and upload your “Go” folder directly to the public_html folder.
  7. Update all your affiliate links to point towards your new redirect!

Your redirect will look something like http://www.yourdomainname.com/go/phpdocumentname.php.

You can name the documents whatever you want, or you can use a different name than “Go” for your folder name.   The important thing is that you remember what you named it so that you can use your new affiliate link!

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Garry Conn says:

    Great write up on this… I am sure that many people have wondered about this as they see its use on some popular blogs such as John Chow’s. I have known about this, but it’s great to have someone do a nice write up on it. 🙂

  2. I use this and I think its a good way to do. Well written.

    Do you know how to do a dynamic redirect for external links – like if i were to link to your blog/site then when the user hovers will see http://justsharepoint/?http://hackwordpress.com – does that make sense?

  3. Hack WordPress says:

    Just SharePoint – Glad you found it useful!

    I don’t know how to do those types of redirects off the top of my head, but I’ve added it to my “to-do” list. I’ll look into it a little bit and see if I can get a post up covering it in the near future.

    Thanks for reading!

  4. Thanks. Look forward to reading that..

  5. A. Marques says:

    Ok, now you’ve convinced me. I’ve been undecided whether to use this method or not for affiliates. Guess I’ll give it a shot.

  6. rhyan says:

    thanks for this info … It helps a lot 🙂

  7. Mike Smith says:

    I’ve used this before. Not with /go/ folder option, but for a few other things and it works great. You can also add a banner to the file you’re adding the redirect to just in case the redirect doesn’t work, the visitor still sees something.

  8. Copes Flavio says:

    Nice post, this was quite useful 😉 it’s also a great way to centralize the control over your links

  9. Susan says:

    This is rated as #1 of my top wordpress plugins – great job!

  10. lida says:

    thanks a lot

  11. TechnoSamrat says:

    Thanks a lot for the tip.. I guess there are also some plugins that does this job.. But I love this one…

  12. Sammy Morris says:

    I have affiliate link codes that also have the “image” in them. Do I also add the image code as well? Does this screw up how the affiliate checks for impressions?

  13. HLC says:

    Found what I’m looking for. Thanks!

  14. Web Hosting Expert says:

    That worked great !


  15. H.KILIC says:

    Thanks for tips.I wanna using it n my blogs.

  16. Fikri Online says:

    its the great idea, but for wordpress beginner like me 😀 its not simple because I must create one file for one affiliate program. We also use http://patchlog.com/wordpress/hidden-affiliate-links-update-version-02/ to hide our affiliate link. Its the best wordpress plugin to hide affiliate link… 🙂

  17. Carol Dent says:

    Could you recommend any specific resources, books, or other blogs on this topic?

  18. Jazz says:

    thank’s bro… Found what I’m looking for. Thanks!

  19. Tony says:

    Worked like a charm! Thanks!

  20. Pori says:

    What if I’ve a lot of such long links and want to automatize it, is there any fine solution? Thanks!

  21. Jesse says:

    I have many websites under public.html, so I thought it should work if I put the “go” file next to the wpadmin, content, etc, just as it would normally be in the public html location.

    But my redirects don’t seem to work

  22. Tamil Blogger says:

    Nice tips.

    actually i was looking this for my site.. I think there a wordpress plugin to workout this. but plugin is too costly for this.

    your guide is too simple and free too.

    thanks dude..

  23. Thanks for this. It’s definitely on my to-do list.

    Is this technique mainly deployed with users or search engines in mind? I’m led to believe search engines will disprove of affiliate links, is this true even when they’re immersed in unique content?


  24. Confused says:

    Sorry to be an utter idiot, but where do I save the ‘Go’ folder? Sorry. I’m new to this.

  25. Vivek Parmar says:

    that’s a great hack. but what about if you have multiple domains, i.e, for main domain i’m using wordpress plugin to hide afffiliate links and for sub-domain this hack is allowed or not??

  26. Daisy says:

    Great tip! Very easy to follow. Thanks for sharing.

  27. Mike says:

    Thanks for the simple way to hide affiliate links.

    It’s very simple and effective and many thanks.

  28. Arafin Shaon says:

    Works like a charm. 🙂 Pretty easy way to hide naughty affiliate links. Thanks for sharing mate 🙂

  29. Ok, this worked out great, but how do we still have the address in the bar show up as what we’ve set the page to be instead of revealing the affiliate link?

    For example if the affiliate link we place in the php code is “http://xyz.com/affiliateid=2” and then the newly created php doc was named doyou located in http://oursite.com/go/doyou how do we get the http://oursite.com/go/doyou to be what still remains shown in the address bar even after it redirects to the affiliate link?

Trackbacks/Pingbacks »

  1. Community Links #5 - Skype on Ubuntu,Forget Traffic, It’s A Waste Of Your Time and more… at WordPress Themes, Plugins, Blog Tips, Make Money Online >> WPthemesplugin.com says:
  2. Blogging Profits | Have Fun Blogging, Then Make Money » Tips says:
  3. Making Money With Text-Link-Ads | ink fingers says:
  4. redopinion.com » Blog Archive » Community Links #5 - Skype on Ubuntu,Forget Traffic, It’s A Waste Of Your Time and more… says:
  5. Easily Create Redirects With the GoCodes WordPress Plugin | net is everything says:
  6. Sådan Skjuler Du Dine Affiliate Links | Tips og tricks til bloggere says:
  7. How to handle links in a smarter way :: fortyplustwo says:
  8. Are You a Free Affiliate? says:
  9. Sådan Skjuler Du Dine Affiliate Links | Michael Grove - Iværksætter says: