Skip to main content

.htaccess Redirect for SEO

Search Engines like to see a website's keywords embedded into the URL. So if I'm selling energy saving washing machines, most SE's, I am told, (Google included) like to see a URL that looks like:
www.energy-saving-washing-machines.com
But if you don't have access to that fancy domain name, then the next best chance is to use something like:
www.whatever-domain-name-you-have.com/energy-saving-washing-machines
This can be setup using a .htaccess file in the document root directory of the www.whatever-domain-name-you-have.com website. Simply create a .htaccess file and drop in the redirection directive as follows:
Redirect /energy-saving-washing-machines "http://www.whatever-domain-name-you-have.com"
So anybody clicking on http://www.whatever-domain-name-you-have.com/energy-saving-washing-machines will be redirected to http://www.whatever-domain-name-you-have.com/

No need to restart/reload Apache

For any such redirections to start working, Apache doesn't need to be reloaded. Just updated the .htaccess file, save it (and make sure it has public read permissions).

Regular Expression Match with RedirectMatch

In case a regular expression match is needed, for example we wish to match both energy-saving-washing-machines and energy-saving-cars, the RedirectMatch directive can be employed instead of Redirect. Use it like:
RedirectMatch energy-saving-* "http://www.whatever-domain-name-you-have.com"
I find this particularly useful for performing matches for keywords and their plurals (ex. http://www.confero24.com/cable and http://www.confero24.com/cables, both of which are relevant keywords from SEO perspective.

Todo

Do search engines have a preference on if the Redirect directive is used with Permenant or Temporary (default)?

Resources

Excellent .htaccess resource: http://www.htpasswdgenerator.com/apache/htaccess.html#8

Comments