301 or 302 Redirect? When should each be used for Search Engine Optimization?

13. January 2010 17:24 by mmcconnell1618

Recently, a BV Commerce customer contacted me and asked me to “fix” the broken redirects in BV Commerce. Their SEO expert system was reporting that 302 redirects were used in BV Commerce and that this was “very bad for SEO and everyone knows it.”

You may have heard the term “301 redirect” and that it is a good thing for search engine optimization. Here’s a little primer on 301 vs. 302 redirects as it pertains to shopping carts and SEO.

The SEO system was walking through every page in the client’s web site and when it found a link to the shopper’s order history it encountered a 302 redirect to the login page. This is the way the software should work but it caused the SEO report to display a warning that 302 redirects are not good for SEO.

When a web browser requests a page the server return a Header and most of the time some HTML to render. Part of the header is a response code. This is a code number that tells the browser how to respond. For example, you may have heard of a “404” error which is the HTML response code for “Missing Object” meaning that the server can’t locate the requested object. If you mistype the name of a web page you may get a “404” error.

“301” or “302” is another response code and they both tell the browser that the requested resource has moved to another location. The big difference is that a “301” code tells the browser that the resource has moved permanently and the “302” code tells the browser that the resource has moved temporarily.

Google and other search engines send out “bots” which are really just web browsers to look at every page in your web site. So, search engines see “301”,”302” and “404” response codes just like any other web browser.

Let’s say that create a page called “LatestNews.html” on your site. Google comes by and indexes the page making a link to “LatestNews.html” in their database. Next month, you rename the page to “OlderNews.html” Google comes back later looking for “LatestNews.html” but it’s gone. Your server may be smart enough to send a “301” redirect which let’s Google know they need to update their database to “OlderNews.html” instead of “LatestNews.html”. However, if your server sends a “302” response. The next time Google comes back they will try “LatestNews.html” again because the “302” code is a temporary redirect.

SEO companies advise clients to always use “301” redirects so that search engines reflect the current names of the pages in your site.

In the case of the BV Commerce customer above, the “302” redirects they were seeing came from the Login.aspx page of the site. When the search engine tool walked through the site it tried to access the order history section. Since the tool was not logged in as a customer, BV Commerce sent them to the login page with a 302 redirect. A 301 redirect would have told the tool that MyAccount_Orders.aspx does not exist any more and is instead called Login.aspx. This is not what you want recorded in a search engine database.

301 = the page/image/resource has moved permanently to a new location

302 = the page/image/resource has moved temporarily to a new location

Currently rated 3.0 by 3 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Comments are closed