What's the Difference Between 301 Redirects and 302 Redirects

When should you use 301 and 302 server redirects

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 in order 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 your pages, this could be a big step backward 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 website. 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:

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

The » symbol indicates a line wrap.

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.lifewire.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

  • 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.
  • 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.
mla apa chicago
Your Citation
Kyrnin, Jennifer. "What's the Difference Between 301 Redirects and 302 Redirects." ThoughtCo, May. 14, 2021, thoughtco.com/301-vs-302-redirects-3468664. Kyrnin, Jennifer. (2021, May 14). What's the Difference Between 301 Redirects and 302 Redirects. Retrieved from https://www.thoughtco.com/301-vs-302-redirects-3468664 Kyrnin, Jennifer. "What's the Difference Between 301 Redirects and 302 Redirects." ThoughtCo. https://www.thoughtco.com/301-vs-302-redirects-3468664 (accessed May 29, 2023).