301 and 302 redirects: the difference in plain words
What do "permanent" and "temporary" mean here?
They describe your plans for the old address. You tell the web what you intend, and the redirect type is how you say it.
A 301 means "Moved Permanently". MDN says it indicates the page has been permanently moved to the address in the Location header.1 The HTTP standard, RFC 9110, adds that the page has a new permanent address, and future references ought to use it.2
A 302 means "Found", and it's the temporary one. MDN says it indicates the page has been temporarily moved.3 The standard explains the logic: because the redirect might be altered on occasion, the client ought to keep using the original address for future requests.2
| Code | Name | What you're saying |
|---|---|---|
| 301 | Moved Permanently | The page has a new permanent address.2 |
| 302 | Found | The page is temporarily at another address.2 |
Which one should I use?
Use the permanent type when the move is for good, such as a renamed page or a new domain. Use the temporary type when the old address will be back, such as a short pause while a service is offline.
Google ties the choice to the page you want searchers to see. Permanent redirects are used as a signal that the new address should be the main one. A temporary redirect isn't treated that way.4 Google's crawler notes spell it out: it uses a 301 as a strong signal that the target should be processed, and a 302 as a weak one.5
Google advises permanent redirects when you're sure the redirect won't be reverted.4 For a temporary case, its example is a service that's temporarily unavailable, where you send visitors to a page explaining what's happening.4
If you're unsure whether the move is permanent, a temporary redirect is the cautious choice. You can switch to a permanent one later, once you know.
Will visitors see a difference?
No, not on screen. Google says users generally won't be able to tell the redirect types apart.4 The difference is in what you're telling search engines, browsers and other tools about the address.
What about 307 and 308?
They're close cousins. MDN says 308 was created to remove ambiguity about how a request's method is handled, for links and actions that aren't ordinary page loads.6 Google's notes treat 308 as the same as 301, and 307 as the same as 302.5 The same notes add that they're semantically different, so it's worth using the code that fits.5
Why does my redirect come out temporary when I wanted permanent?
Some servers pick the temporary type unless you say otherwise. Apache's Redirect directive is one. Its documentation says that if no status argument is given, the redirect will be "temporary".7 Adding the permanent keyword returns the 301 status instead.7
nginx has a similar choice in its rewrite directive. The redirect flag returns a temporary redirect with the 302 code, and the permanent flag returns a permanent one with the 301 code.8
So read the type off the result, not off what you meant to write. The testing page shows how. The search engine page goes deeper on what Google's own documents say.
Cited material
- 301 Moved Permanently, MDN Web Docs (Mozilla)
- RFC 9110: HTTP Semantics, IETF (RFC Editor)
- 302 Found, MDN Web Docs (Mozilla)
- Redirects and Google Search, Google Search Central
- How HTTP status codes affect Google's crawlers, Google Search Central
- Redirections in HTTP, MDN Web Docs (Mozilla)
- Apache module mod_alias, Apache HTTP Server Project
- Module ngx_http_rewrite_module, nginx