301 Redirect – Moving To A Better Place…

Moving to a new domain and don’t want lose your hard earned traffic and search engine rankings?

Keep reading…

What will follow is a nice way to push http clients (browsers and spiders alike) over to a different domain,

and make the spiders drop the old records that they have in their index and replace them with the new ones that you will “serve” them.

Be warned though that it takes time for them to rebuild their index. The best option is to have the old domain up and running for at least 6 months after you do the transfer.

  • What Is A 301 Status Code?

What we need is our server to present to everyone an http header with a 301 status code, which means that whatever they were looking for has permanently moved to a new location and we provide the location at the same time.

  • What Is An .htaccess File?

When a visitor or a spider requests a web page, your web server (Apache) checks for an .htaccess file.

The .htaccess file contains specific instructions like redirection issues, security and how to handle certain errors.

You will have to create an .htaccess file at the top level directory (Document Root).

Linux Ex.:/usr/local/apache/htdocs/

Windows Ex.:C:\apache\htdocs\

  • Requirements:

Apache Web Server

Rewrite_Mod Enabled (Every serious hosting company has that on)

Enough With The Theory…Hand Over The code 🙂

Ok.Your .htaccess file on the old domain would be:

————————————————————————–

Options +FollowSymLinks

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com

RewriteRule (.*) http://www.yournewdomain.com/$1 [R=301,L]

Redirect PERMANENT /forum/ http://www.yournewdomain.com/forum/

—————————————————————————

Keep in mind that the URLS are case sensitive.

You can make it work for directories too. Say you have a forum on a folder one level deeper

then your htdocs.

That is what the last line does and by adding the PERMANENT flag has the same effect as [R=301] in the line above.

  • Beware The Old Man

You should be aware though for there is indeed such a thing called domain age.

Search Engines know how old a domain is.

Google for example uses it as one of their main criteria, along with content, linking from other sites, etc…

For more information about .htaccess, rewriting_mod, rules and directives you should check the Apache web site.

That’s all folks 😀

Published by

2 thoughts on “301 Redirect – Moving To A Better Place…”

  1. Nicelly done 😀

    Was looking for ages something that i could plainly understand..

    Thanks for the great info!!

  2. Pingback: Morgan Hart

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.