What's the Difference Between 301 Redirects and 302 Redirects

When Should You Use 301 and 302 Server Redirects?

301 - Moved Permanently
GirlieMac/Flikr/CC BY 2.0

What is a Status Code?

Whenever a Web server serves up a web page, a status code is generated and written to the log file for that web server. The most common status code is "200" - which means the page or resource was found. The next most common status code is "404" - which means the requested resource was not found on the server for some reason.Obviously, you want to avoid these "404 errors", which you can do with server-level redirects.

When a page is redirected with a server-level redirect, one of the 300-level status codes is reported. The most common are 301, which is a permanent redirect, and 302, or the temporary redirect.

When Should You Use a 301 Redirect?

301 redirects are permanent. They tell a search engine that the page has moved - probably because a redesign which uses different pages names or file structures. A 301 redirect requests that any search engine or user agent coming to the page to update the URL in their database. This is the most common type of redirect that people should use both from an SEO (search engine optimization) standpoint and from a user experience perspective. 

Unfortunately, not all web designs or companies use 310 redirects. Sometimes they instead use the meta refresh tag or 302 server redirects. This can be a dangerous practice. Search engines don't approve of either of these redirection techniques because they are a common ploy for spammers to use to get more of their domains up in search engine results.

 

From an SEO perspective, another reason to use 301 redirects is that then your URLs maintain their link popularity because these redirects transfer a page's "link juice" from the old page to the new. If you set up 302 redirects, Google and other sites that determine popularity ratings assume that the link is eventually going to be removed completely, so they do not transfer anything at all since it's a temporary redirect.

This means that the new page doesn't have any of the link popularity associated with the old page. It has to generate that popularity on its own. If you've invested time building out the popularity of the your pages, this could be a big step backwards for your site.

Domain Changes

While it is rare that you would need to change your site's actual domain name, this does happen from time to time. For instance, you may be using one domain name when a better one becomes available. If you secure that better domain, you will need to change not only your URL structure, but the domain as well.

If you are changing your site's domain name, you should definitely not use a 302 redirect. This almost always makes you look like a "spammer" and it can even get all your domains blocked from Google and other search engines. If you have several domains that all need to point to the same place, you should use the 301 server redirect. This is common practice for sites that buy additional domains with spelling errors (www.gooogle.com) or for other countries (www.symantec.co.uk). They secure those alternate domains (so that no one else can grab them) and then redirect them to their primary Web site. As long as you use a 301 redirect when doing this, you won't be penalized in search engines.

Why Would You Use a 302 Redirect?

The best reason to use a 302 redirect is to keep your ugly URLs from being indexed permanently by search engines. For example, if your site is built by a database, you might redirect your homepage from a URL like:

http://www.about.com/

To a URL with lots of parameters and session data on it, that would look like this:

(Note: The » symbol indicates a line wrap.)

http://www.about.com/home/redir/data? »
 sessionid=123478&id=3242032474734239437&ts=3339475

When a search engine picks up your home page URL, you want them to recognize that the long URL is the correct page, but not define that URL in their database. In other words, you want the search engine to have "http://www.about.com/" as your URL.

If you use a 302 server redirect, you can do that, and most search engines will accept that you're not a spammer.

What to Avoid When Using 302 Redirects

  1. Don't redirect to other domains. While this is certainly possible to do with a 302 redirect, it has the appearance of being much less permanent.
  2. Large numbers of redirects to the same page. This is exactly what spammers do, and unless you want to be banned from Google it's not a good idea to have more than 5 URLs redirecting to the same location.

Original article by Jennifer Krynin. Edited by Jeremy Girard on 10/9/16