SysAdmin Blog, TechTips and Reviews

Unix Basic Commands and Interview Questions/Answers



301 Redirects | .htaccess Redirects

August 27th, 2008 by elizar

301 redirect

301 .htaccess redirect is the safest search engine redirect there is! This is also the friendliest method for web page redirection. Most web hosting company and web master out there will definitely recommend this method of web page redirection. The code “301″ is interpreted as “moved permanently”.

For websites hosted in either dedicated server or a shared web hosting server, you use 301 redirects in redirecting a single html page or an entire website.

Here’s and example of redirecting a single page/html page:

Redirect 301 /oldpage.html http://www.example.com/newpage.html

For a whole website, you can use 301 redirect in this manner:

Redirect 301 / http://www.example.com/

Personally on my shared web hosted site, I only use the HTML redirect. But there are other use of the 301 redirect on a web sites.

Here are other use of it:

  1. Changed file extension
  2. Redirect web site with ‘www’ to not having one.
  3. vice versa of the previous example.
  4. Redirect example.com/index.php to example.com/

So next time you moved your web site content from one web hosting server provider to another or moving your site to a new domain name, you can definitely use the 301 redirect.

2 Responses

  1. htaccess redirect Says:

    Don’t forget 301 redirecting is great if you want to move one directory to another or a directory to the root domain of your website. You can also use mod_rewrite and not have to physically move any files at all.

  2. San Diego Web Designer Says:

    And the the htaccess file for canonical issues such as www or non www to prevent url bleeding

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

I was here...