The “301″ refers to what is called the HTTP status code. This status code is what is returned to your browser (or search engine) when a page is requested.
The most familiar status code for the average person that uses the Internet is the “404″ page not found code. This happens when a page that you have requested is not found at the address that you visited.
A “301″ status code means that a page has permanently been moved to a new location. In contrast, the “302″ status code indicates that a page has only temporarily been moved.
Generally speaking, a 301 redirect is the most search engine friendly method for redirecting users and engines to a new location. This method should be used any time you have permanently moved a page, or site, to a new address.
This includes any time that you have changed the names of web pages in your site, moved your site to a new domain, or pointed an extra domain at an existing site.
There are a number of ways to accomplish the 301 redirect. Some are dependant on the server that you are hosted on, and some methods are pure choice.
Redirect in ColdFusion: <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-url.com"> Redirect in PHP: <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?> Redirect in ASP: <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com" > Redirect in ASP .NET: <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } </script> .htaccess Redirect Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
If you are currently using a redirect in your site, you can use the following tool to verify that you are making proper use of the 301 redirect.















Pingback: htaccess Cheatsheet
Pingback: Pipe Ten Web Hosting Resource » Blog Archive » .htaccess cheat sheet