Importance of 301′s
In the world of the internet there are several different types of responses a server can send to a user. The most common is what is known as a “404 Error” or page not found. There’s also the horrible 500 error which is generally caused by an issue with the code or actual server. And one that is generally seen by all users, but not seen at all. It’s a set of 2 magical numbers, 301 and 302. What are they? Read on…
302′s are the first I’ll talk about since they are “Temporary”. This is used if you are working on a page lets say your “about us page” and you don’t want people or search engines to go there, but want them to come back later. You can 302 a page to a temporary page, and later stop forwarding it. For everyday users this really doesn’t do much, but for Google etc. This tells them come back later an re-index the original page you attempted to get too. So it’s very useful if you are developing a site and have links to a page and Google finds you.
But the more important one is a 301 redirect. This is a permanent forwarding, and tells search engines. “You found something that is now over here forever —-> Don’t index me, index the new page, oh and also if the page you were looking for had page rank, the new page should have it now.” This is very useful if you are pushing a new website out that will replace an existing one. A 301 can be from one domain to another or from one page in a domain to another. So if you are creating a new search engine friendly url and want to make sure any previous page that was indexed is now recognized as the new page you would use this.
example: http://www.dannycoburn.com/signup.php might get forwarded to http://www.dannycoburn.com/viri so any thing that was indexed on signup.php is now pushed to the new /viri directory.
The most IMPORTANT use of 301′s that you can possibly use for search engines is to ensure that all pages are viewed the same by the search engines. Did you know that http://dannycoburn.com and http://www.dannycoburn.com are 2 different pages? They don’t look like it but for some reason search engines will treat them differently. So what do you do? You need to make sure you 301 all non-www pages to their comparable www page. Want to see an example? Click this http://dannycoburn.com. You’ll see it adds the www.
If you are on an apache server (if you are on a linux host you probably are), here’s the code you put into your .htaccess folder
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
Until next time.

August 8th, 2008 at 6:00 pm
Thanks for explaining this Danny. Very helpful. I’m doing redesigning several of my websites and I want to get re-indexed by the bots. How would I implement this? Do I replace each old page with a 301 redirect to point to the new page address? What is the code for the old page?
thanks, Shayne
P.S. I like your blog. Useful information.
August 8th, 2008 at 6:16 pm
Shayne,
It’s actually very easy in your .htaccess file you simply do this for each of the pages:
Redirect 301 /oldpage.html http://www.example.com/newpage.html
Now you can also do this programatically using something like this in php:
< ?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com” );
?>