301 Redirects

By Eric Enge

301 redirects play a major role in search engine optimization. They enter into the equation in many different situations, but the 2 most common situations are:

  1. All sites should redirect all URLs associated with their domain which do not start with "www" (i.e. "http://yourdomain.com") to the same pages on your their domain that start with "www" (i.e. "http://www.yourdomain.com"). This is referred to as a canonical redirect. The reason this is important is that search engines are not smart enough to tell if the non-www version of your domain is really a different site, or not, than the www version of your domain. And, if other people link to your site, you can't can't control whether or not they link to your site with a www or not.
  2. You decide to move the content on one or more pages of your site to a new URL. Sometimes you may do this simply because you are improving the site architecture, or you may do it because you are moving to a new domain.

In either of these situations, you should use a 301 redirect. Other redirects are dangerous to use. Both the 302 redirect and the meta-refresh technique for performing redirects are potentially harmful to your site's ranking in the search engines. The 301 redirect is seen as a "permanent move" of the content, and the links to the page, to a new location and the search engine acts accordingly. The 302 redirect and meta refresh are seen as "temporary moves" of the content.

Specifically, when a search engine sees a temporary redirect, the search engine continues to assume that the redirecting URL is the owner of the content. This means that all link credit associated with the redirecting page is associated with the redirecting page, and not the new page. In addition, you may get flagged as being a potential spammer, because in the past, spammers used temporary redirects to other people's sites as a way of stealing traffic from them.

When a search engine sees a permanent (301) redirect, it assumes that all credit for links to the redirecting page actually belong to the new page. This helps search engines transition to indexing the new page very quickly, and does not bear the potential stigma of association with past spammer tactics.

So now that you know that you need to do a 301 redirect when you move content, or to move non-www URLs to www URLs, what is the proper technique? It depends on your OS. Here is how it breaks down:

  • Unix and Linux users should use .htaccess files. This is a simple server level technique for handling redirects. You can use "mod rewrite" rules as a powerful method for redirecting many URLs from one location to another. Click here to learn more about mod rewrite. For example, you can redirect all non-www traffic to all www URLs, with the following Mod Rewrite script:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} yourdomain\.com [NC]
    RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC]
    RewriteRule ^(.*) http://www.yourdomain\.com/$1 [L,R=301]
  • Windows users should use IIS Redirects if at all possible. This is also a server level redirect that is transparent to search engine crawlers. The procedure you should follow is:

    • Go to Internet Services Manager and right click on the file or folder you wish to redirect
    • Click on the radio button titled "A redirection to a URL"
    • Click on the check boxes titled "the exact URL entered above" and "a permanent redirection for this resource"
    • Click on "apply"

    If you do not have access to your server, or if your host will not take care of this for you, you need to relay on a PHP script (requires that your old page and your new page both be coded in PHP). Here is some sample code for PHP:

    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.new-url.com" );
    ?>

Use 301 redirects whenever you are moving content on a permanent basis, in order to preserve your search engine rankings to the best degree possible. For most webmasters, 302 redirects and meta-refreshes should never be used.

One exception to this is if you are unable to setup a 301 redirect (perhaps you can't get access to your .htaccess file because it's on a shared server), you can use a metarefresh set to 0. It appears that search engines are now treating this the same as a 301. But make sure its set to 0. Here is the proper code:

<meta http-equiv="refresh" content="0">

Note that search engines behave differently when processing search engine redirects. All of them will handle the physical redirection of traffic as expected. What becomes more complicated is when you have a page below your home page that has direct external incoming links. If you make drastic changes, such as moving to a new domain, or renaming all the URLs on your site, make sure you redirect all pages from the old URLs to the equivalent new URL. For example, redirect:

http://www.yourolddomain.com/article-317

to

http://www.yournewdomain.com/article-317

The search engines normally handle complex redirect situations such as this very efficiently and will update their index very smoothly and quickly, and pass on all link credit from the old page to the new page. While this does happen correctly the great majority of the time, there are horror stories out there about errors in the process, and our own experience has not always shown perfect results.

For that reason, you should only move URLs, or domains, when you really need to. Its important to not rely on these techniques unless you have to. But if you do, the 301 redirect is the tool of choice.

About the Author

Eric Enge is the Founder and President of Stone Temple Consulting (STC). STC offers Internet marketing optimization services, including SEO, Social Media and PPC optimization, and its web site can be found at: http://www.stonetemple.com.

 Subscribe to STC articles by reader
 Subscribe to STC Articles by Email

TwitterFollow Stone Temple on Twitter


Interviews, Studies, and Posts

2007 Interviews and Podcasts

2006 & 2007 Interview Archive page.

This Old Web Site Case Studies

SEO and Web Marketing

Social Media Optimization

Other Major Search Topics

Analytics Articles

Google Co-Op Feed

Get our SEO articles in Google search results by subscribing to our Google Co-Op Feed.



 Subscribe to STC articles by reader
 Subscribe to STC Articles by Email


For more information on Web Marketing Services, contact us at:

Stone Temple Consulting
(508) 879-0950 (phone)
(603) 676-0378 (fax)
Contact Stone Temple Sales