When to Use a 301 vs. 302 Redirect - SEO Tip Week 35

Sunday, September 2nd, 2007

SEO TipsThere are two types of redirects you can use, a 301 and a 302. These numbers refer to the HTTP Status Code returned by the server for a given URL. A 301 redirect tells the search engine that the page has moved permanently to the new URL. A 302 redirect tells the search engine that the move is only temporary, and you may decide to show content at the original location in the future without a redirect.

301 Redirects
All three major search engines handle 301 redirects the same, that is to say they ignore the original URL and instead index the destination URL. For example, www.beekerfurniture.com uses a 301 redirect to www.hendersonsfurniture.com and Google, MSN and Yahoo all return the result www.hendersonsfurniture.com when searching for “beeker furniture”. The word beeker doesn’t appear anywhere on the hendersonsfurniture.com site, and a site search in Google shows that only the home page has any relevance for the word. Clicking on the Cached link in the site search results further shows that the word only exists in links pointing to the site, “These terms only appear in links pointing to this page: beeker.” Those links Google is referring to are actually pointing to www.beekerfurniture.com and the 301 redirect is passing along the relevance of the word beeker to hendersonsfurniture.com.

301 redirects can be very powerful when you redesign your site and the URLs change, move to a different domain, acquire a new domain, or implement a URL rewrite. In most cases, this is the type of redirect you want to use because you know exactly how the search engines will respond.

302 Redirects
The three major engines handle 302 redirects very differently, and because of this 302s are typically not recommended.

Google treats 302 redirects differently depending if they are on-domain or off-domain. An example of an on-domain redirect is athletics.mlb.com which uses a 302 redirect to http://oakland.athletics.mlb.com/index.jsp?c_id=oak. If you search for “oakland a’s” in Google you will see that athletics.mlb.com is displayed in the results because links point to that URL, which in turn uses a 302 redirect to the destination page. This is a great example where 302 redirects can be used effectively, since the shorter URL looks much more enticing in the results pages.

Off-domain 302 redirects would be ripe for hijacking situations if treated the same way. Because of this, in most cases, Google will treat off-domain 302 redirects like 301s, where they will ignore the original URL and instead index the destination URL. I say most cases because Google will sometimes determine that the 302 is legitimate & index the original URL instead. An example of an off-domain redirect is pets.roanoke.com which uses a 302 redirect to a third-party site http://www.gadzoo.com/roanoke/pets.aspx. In this case, Google determined that this was a legitimate use of a 302 redirect and displays pets.roanoke.com when searching for “pets roanoke”.

MSN treats 302 redirects exactly how it treats 301 redirects, it will always ignore the original URL and instead index the destination URL. A search for “oakland a’s” in MSN shows the URL oakland.athletics.mlb.com/index.jsp?c_id=oak in its results. And a search for “pets roanoke” shows www.gadzoo.com/roanoke/pets.aspx in its results.

Yahoo takes the same stance that MSN takes, except that they reserve the right to make exceptions in handling redirects. A search for “oakland a’s” in Yahoo shows the URL www.oaklandathletics.com in its results. (www.oaklandathletics.com also uses a 302 redirect to http://oakland.athletics.mlb.com/index.jsp?c_id=oak) But a search for “pets roanoke” shows www.gadzoo.com/roanoke/pets.aspx in its results.

There are very few times where you actually want a 302 redirect, although they are used more often than 301s merely because most people don’t know the difference. 302 redirects are often the default redirect in website control panels, and JavaScript or Meta redirects will produce a 302 status as well. In certain situations however, 302 redirects work wonders.

As with all our tips, please use them responsibly. When in doubt, use a 301 redirct.

Popularity: 15% [?]

How to do a 301 Redirect

Monday, June 19th, 2006

301 permanent Redirect

Redirects are essential for some websites. Without them pages don’t get indexed and that hurts your search engine visibility. The best way to do a redirect is to use a permanent 301 redirect. A permanent 301 redirect sends a status code to the browser alerting that the page has moved and a new page is taking its place-redirecting it permanently.

Here are a few ways you can achieve a 301 redirect:

Redirect from a subdomain to a domain

It is important for SEO that all of your backlinks go to the same URL.
Remember, www.bigoakinc.com, bigoakinc.com, www.bigoakinc.com/index.html and bigoakinc.com/index.html are all different pages to the search engines. We want all the PageRank funneling to one page.

This can be helped with a 301 redirect to send browsers and bots who go to one of your home page variations. Modifying your .htaccess file that sends a 301 redirect status is where to start.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

If your host doesn’t allow mod_rewrite, you can use this code in an .htaccess file

Redirect 301 http://domain.com/oldpage.html
http://www.domain.com/newpage.html\

Code for various 301 redirects:

PHP Redirect
< ?
header(’HTTP/1.1 301 Moved Permanently’);
header(’Location: http://www.newdomain.com/newdir/newpage.htm’);
exit();
?>

ASP Redirect

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.newsite.com/newdir/newpage.asp”
%>

ASP.NET Redirect
.NET ASP 301 code

ColdFusion Redirect
< .cfheader statuscode=”301″ statustext=”Moved permanently”>
< .cfheader name=”Location” value=”http://www.new-url.com”>

Please use the information responsibly and be sure this will be a 301 permanent redirect. Moving it again can upset the search engines.

Popularity: 3% [?]

About Big Oak SEO Blog

This SEO blog is provided by Big Oak, a SEO services company. Most blog posts on this SEO blog are related to search engine optimization, short reviews, SEO tips and increasing site conversions. Email us at contact@bigoakinc.com to see how we can help your company. More

Want to know what Shell is doing?
Follow Shell with Twitter, just don't expect to much.

Want to subscribe?

 Subscribe in a reader Or, subscribe via email:    
Enter your email address:  
Find entries :