.htaccess 301 Redirect

.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis in an Apache HTTP Server. This file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

This 301  Redirect can be used anytime you want to redirect a URL. Here are some examples of its use:

  • Single page – Redirect 301 /old_page.html http://www.mysite.com/new_page.html
  • entire site –   Redirect 301 /  http://www.new_site.com/
  • change file extension (html to php in this case) –  RedirectMatch 301 (.*)\.html$ http://www.mysite.com$1.php

There are many other uses for Redirect 301 and mod_rewrite on Apache, if you are moving a site or redesigning a site with a new CMS make sure you redirect your old URLs to your new site. By failing to do so any user that clicks on a link to your old site (page) will hit a 404 ERROR page, this will affect your search rankings. 

The book “Professional SEO” has a good chapter in mod_rewrite and URL redirection, and is also great SEO manual

For a full tutorial on .htaccess visit the official Apache website.

Technorati Tags: , , , , , ,

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>