Setting Up a .htaccess File Redirection System for Affiliate Links

About .htaccess File

.htaccess file is a special type of file resident in your server (Apache and various other popular web servers, not Microsoft IIS) that can be used to achieve various things, such as customized 404 error messages, authentication, cache control, and URL redirects.

Before you can use the .htaccess file, you need to know if your web host supports it. A good indication is if your web server allows password protection of folders, then they should use .htaccess file. Most of the popular servers have support for this file, though the second largest web server, MS IIS doesn't support it. To do such things in IIS, you need to use Microsoft snap-in called Microsoft Management Console (MMC), which is available in all Windows versions since 2000.

A .htaccess file doesn't have a file name (unlike normal files, 'document.doc', 'blogpost.txt', 'grammarpost.html', etc.). It is just an extension, 'htaccess'. Therefore, most of the operating systems may not allow you to create a file like this. Windows doesn't. What you need to do is create a file with another name like 'htaccess.txt' or 'file.htaccess' and change it to '.htaccess' after uploading to server (don't forget the dot, and don't include the quotes).

Each command in the .htaccess file should be included in a fresh line.
[More on .htaccess file at Apache Site]

Affiliate Link Redirecting

I suggest you create a directory called 'go' in your web server and use it for all product redirects. Any product you wish to set up redirection to affiliate link should use the following method.

Once you have the .htaccess file on your server, add the following command in the .htaccess file:

redirect 301 /go/productsite.htm http://www.productaffiliatelink.com

This command permanently redirects a user that tries to access "http://yoursite.com/go/productsite.htm" to the product's affiliate link. Making it a 301 (permanent) redirect will help search engines not index the go/productsite.htm file. When search engines find permanent redirects, they don't index it.

Related Entry:

Affiliate Link Redirect Using JavaScript

Copyright © Lenin Nair 2008

1 Opinions:

  1. I think you are speaking way over most people's heads, including mine.

    ReplyDelete

Comments are moderated very strictly