Quite a few people have asked me about how I hide my affiliate links (eg. Text Links Ads, Review Me, Amazon). There are many techniques out there. Most tell you to create a php file in notepad then use a header function in PHP to redirect your files and then upload that php file through FTP. That means: more files, more directories, more unorganized information, and more headache. This is way too long, confusing, and useless.

There’s a simpler way.

Most hosting companies gives you the telnet access to your site. Please consult your hosting service for this. The other way to do it is to create a file called “.htaccess” in notepad and write all your redirects and then upload the file. CAUTION: Make sure you don’t replace your currently existing “.htaccess” file. So back up the current “.htaccess” file, and then download that file, make necessary changes, then upload it back.

Here’s how I do the redirects:

  • Open “.htaccess” file through telnet.
  • Insert this line: Redirect /dreamhost http://www.dreamhost.com/r.cgi?257222

That’s it! What that does now is, once you type: http://deafmusician.com/dreamhost/, it will redirect it to the URL next to the directory name. Make sure you have a full understanding of “.htaccess” files before you proceed, I am not responsible for any mistakes you might make. Feel free to post a comment if you have any questions.

There’s also a plug-in that can do this.

7 Comments: “Hiding Affiliate Links - The Easiest Way”

MyAvatars 0.2 Wallace
September 7, 2007 @ 8:06 pm

one more method that no .htaccess knowledge need.

MyAvatars 0.2 DM
September 9, 2007 @ 5:45 pm

Oh certainly there’s million ways to achieve this, I just use the easiest solution I know.

MyAvatars 0.2 Deron Sizemore
September 11, 2007 @ 6:08 am

Interesting. I’ve never even thought about hiding my affiliate links.

You said “Once you type:…” what about simply clicking? Will this also work (Sorry, not real familiar with .htaccess)?

Lets say I’ve got an affiliate link banner on my site and I set up a redirect for it through .htaccess…When you write the redirect as /dreamhost http://www.dreamhost.com/r.cgi?257222, will you then be able to simply use the hyperlink of deafmusician.com/dreamhost on the banner and it will work? (hope that made some sense)

MyAvatars 0.2 DM
September 11, 2007 @ 8:57 am

“once you type” refers to, yep, clicking or someone linking to it, or if they type in that url that sort of thing. And to answer your second question, yes! This also comes in handy for updating mass linking. For example, let’s say you’re doing hosting affiliate link, and you no longer host with dreamhost… instead of changing all the links, you would just go into .htaccess file and change that one line and all the links will be automatically updated!

MyAvatars 0.2 Deron Sizemore
September 11, 2007 @ 9:06 am

Nice!

Okay, another question. I already have an .htaccess file in the root of my web server with some code already in there pertaining to my content management system. Can I simply add the redirect to the bottom of this existing .htaccess file and have it work with the other codes already there? Or do I create a new htaccess file?

MyAvatars 0.2 DM
September 11, 2007 @ 9:19 am

Yep, you would add the redirect code to the bottom of that same file. If you want to differentiate it, use comments so you know what it is. Comments are done with the sharp sign (#). So, insert # Redirect Locations and in the next line type in the code mentioned above.

MyAvatars 0.2 Deron Sizemore
September 11, 2007 @ 10:18 am

Great, thanks. I’ll have t o try this out.

Say Something