Use .htaccess Redirects
Thanks for visiting the Affiliate Tip blog. Subscribe to my RSS feed or enter your e-mail on the top left to get updates by e-mail.
There are many reasons to redirect affiliate links, such as the ability to shorten them for text newsletters, and cloaking your links.
The most common was to redirect links is with a META refresh tag or a JavaScript. This is easy enough, but there’s an even better, easier way to redirect your links: the .htaccess redirect.
An .htaccess file is a plain ASCII text file you place in the root directory of a Unix server. The .htaccess technique is much easier than using other redirects, because there’s no HTML required. All of your redirects are in one text file.
.htaccess uses redirect to look for any request for a specific page (or a non-specific location, though this can cause infinite loops) and if it finds that request, it forwards it to a new page you have specified.
For instance:
Redirect /olddirectory/oldfile.shtml http://www.yourdomain.com/newdirectory/newfile.shtml
In the example above, there are three parts, and they should all be on one line:
- the Redirect command
- the location of the file/directory you want redirected relative to the root of your site (/olddirectory/oldfile.shtml = yourdomainsite.com/olddirectory/oldfile.shtml)
- the full URL of the location where you want to redirect
Each of the three parts is separated by a single space, and all must be on one line. You can also redirect an entire directory by simply using:
Redirect /olddirectory http://www.yourdomain.com/newdirectory/
Using this method, you can redirect any number of pages no matter what you do to your directory structure.
Please note – you should be careful if you’re going to edit an existing .htaccess file. Before making any changes, make a copy of the original file, so if you make any mistakes, you’ll still have the original file.
- Posted in Affiliate Tips
Thank you for great information. This post helped me a lot.
reply to this commentThank you for great information. This post helped me a lot.
reply to this commentI've been using PHP redirects, but I'm unhappy with the link structure: .com/visit?destination – so I've been planning (for like, six months!) to give htaccess a shot. Thanks for reminding me.
reply to this comment