<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d32007719\x26blogName\x3dSuper+Des\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://super-des.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://super-des.blogspot.com/\x26vt\x3d6090589047922094477', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

301 Redirects

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:
o Go to Internet Services Manager and right click on the file or folder you wish to redirect
o Click on the radio button titled "A redirection to a URL"
o Click on the check boxes titled "the exact URL entered above" and "a permanent redirection for this resource"
o 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:

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:

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

Google handles complex redirect situations as this very efficiently and will update its index very smoothly and quickly, and pass on all link credit from the old page to the new page. In our experience, Yahoo can take 6 to 8 months to correctly pass on all link credit for links to the old URL(s) to the new URL(s).

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.

by Eric Enge

About the Author
Eric Enge is the President of Stone Temple Consulting.

“301 Redirects”