A 301 (Moved Permanently) tells browsers and search engines that the old URL has been replaced for good, so they should use and index the new one. A 302 (Found) says the content is at another URL only for now, so the old URL should stay in use. Use a 301 for domain changes, HTTPS migrations and restructured URLs; use a 302 for short-term moves such as maintenance pages or tests.
At a glance
| Code | Name | Meaning | Method on follow |
|---|---|---|---|
| 301 | Moved Permanently | Permanent | May change POST to GET |
| 302 | Found | Temporary | May change POST to GET |
| 303 | See Other | Go and fetch with GET | Always GET |
| 307 | Temporary Redirect | Temporary | Same method and body |
| 308 | Permanent Redirect | Permanent | Same method and body |
301 and 302 in practice
| 301 | 302 | |
|---|---|---|
| Browser caching | Cached aggressively | Usually not cached |
| Search engines | Treat the new URL as the lasting one | Keep the old URL indexed |
| Typical use | HTTP to HTTPS, domain or URL moves | Temporary maintenance, A/B tests, location-based routing |
| Mistake costs | Hard to undo because of caching | Search engines may not move to the new URL |
Check what a URL really does with the HTTP Redirect Chain Tracer, which lists every hop and its status code, and look up unfamiliar codes in the HTTP Status Code Lookup. To write the redirect rules for an Apache server, use the .htaccess Redirect Generator.
Which should you choose?
- Content has moved for good: 301 (or 308 for non-GET requests).
- Short-lived or conditional move: 302 (or 307 to keep the method).
- After a form submission, send to a results page: 303.
- Unsure: start with a 302 and switch to a 301 once you are certain, because permanent redirects are cached.
- Avoid chains: point old URLs straight to the final destination, not through several redirects.
The full code list is in HTTP Status Codes Cheat Sheet, and Redirect defines the term.