Comparison
The status codes that decide what happens to a URL
Six codes do almost all the work, and choosing between them is a decision about what you want a search engine to remember. A redirect tells it to move its record to somewhere else; a 404 tells it this address is empty today; a 410 tells it the address is finished with.
Side by side
| Code | Means | Passes ranking on | Method after redirect |
|---|---|---|---|
| 301 | Moved permanently | Yes | Can change POST to GET |
| 302 | Found, temporarily elsewhere | Stays with the original | Can change POST to GET |
| 307 | Temporary redirect | Stays with the original | Preserved |
| 308 | Permanent redirect | Yes | Preserved |
| 404 | Not found | Nothing to pass | n/a |
| 410 | Gone, deliberately | Nothing to pass | n/a |
The short answer
Use 301 when the new address is the one you want remembered, and 302 when the old one is coming back. The difference between 307 and 302 only shows on a form submission, where the older codes are permitted to turn a POST into a GET and quietly lose what was submitted. And when a page is genuinely retired rather than missing, a 410 says so, which clears it from an index noticeably faster than a 404 that might just be a mistake.
In more detail
Why 307 and 308 exist at all
The original specifications allowed a client receiving a 301 or 302 to change a POST into a GET when it followed the redirect, and browsers did exactly that. For a form submission it means the data quietly goes nowhere. 307 and 308 were defined to forbid the change, which is why the difference between 302 and 307 is invisible on an ordinary page and decisive on a form.
410 clears an index faster than 404
A 404 might be a mistake - a typo, a temporary failure, a page that will come back - so crawlers retry it for a long time. A 410 says the page is deliberately finished with, and it is dropped considerably sooner. For pages genuinely retired, saying so is worth the small effort of configuring it.
Redirect chains cost more than they look
Each hop is a round trip before anything renders, and long chains are eventually abandoned. When a URL has moved twice, point the original at the final destination rather than letting it walk the chain. The same applies to the http to https to www sequence, which is three hops when it could be one.