Skip to main content

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

This command permanently redirects a user that tries to access "" 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. I think you are speaking way over most people's heads, including mine.


Post a Comment

Comments are moderated very strictly

Popular posts from this blog

What Is the Difference Between Hardcover and Paperback?

Today, my reader, Rahman contacted me with a doubt:

Dear Lenin, would you explain why there are two types of books: hardcover and paperback?
This is quite a simple affair and there are explanatory articles to be found at various places on the Net. Here is my addition.


A hardcover aka hardback is a book bound with thick protective cover, with usually a paper or leather dust jacket over the main cover. The aim of hardcover is protection and durability. These books are mainly for long-term use and collectors’ editions. Hardcover books last far longer than the corresponding paperbacks. They do not get damaged easily thus making them perfect for reference guides, great literary works, etc.

In addition, there is a difference in the type of paper used to print hardcover books. The paper used is long-lasting acid-free type. Acid-free paper has a pH value of 7 (neutral) which makes it highly durable. The papers are stitched and glued to the spine.

Hardbacks are prepared for commercial …

En Dash, Em Dash, and Hyphen

We have three types of dashes in use: The hyphen, En Dash, and the Em Dash. In this post, we will see how to use them all correctly.

Hyphen (-)

The hyphen is the minus key in Windows-based keyboards. This is a widely used punctuation mark. Hyphen should not be mistaken for a dash. Dash is different and has different function than a hyphen.

A hyphen is used to separate the words in a compound adjective, verb, or adverb. For instance:

The T-rex has a movement-based vision.
My blog is blogger-powered.
John’s idea was pooh-poohed.

The hyphen can be used generally for all kinds of wordbreaks.

En Dash (–)

En Dash gets its name from its length. It is one ‘N’ long (En is a typographical unit that is almost as wide as 'N'). En Dash is used to express a range of values or a distance:

People of age 55–80 are more prone to hypertension.
Delhi–Sidney flight was late by three hours.

In MS Word, you can put an En Dash either from the menu, clicking Insert->Symbol or by the key-combination, Ctrl + Num…

What Is the Meaning of the Word 'Ghajini'? Story and Trivia of Aamir Khan's New Film [Special]

[Special Entry]

Aamir Khan's latest film is titled a little weirdly for the taste of Hindi filmgoers. 'Ghajini': They have never heard of such a name, and such a word never existed in Hindi or in any other Indian language.

The name Ghajini is the name of the villain of the film. In Tamil version, the name of the villain was Laxman.

As a Tamil moviegoer, I have already watched Ghajini and know the story in full.

So, What Does the Title Mean?

In Tamil, the title of the film is inspired by the story of Mahmud of Ghazni, an ancient invader of India. This person was so persistent in invading India that he continued trying after several failures. In the film too, the protagonist is such persistent in finding out and killing the villain of the film, who had killed his girlfriend, Kalpana (played by Asin). Aamir's Character (named Sanjay Ramaswamy in Tamil), is a short-term amnesiac, who cannot remember anything more than fifteen minutes.

You may ask then how the Ghazni became…