301, 302, 307 and 308 redirects: what each code means
Use a 301 when a page has moved for good. Use a 302 when the move is only for a while. That covers most small sites. The 307 and 308 codes are close cousins, and the differences are small.1
The four codes side by side
Each code is a number the server sends along with the redirect, so browsers and search engines know what kind of move it is.
| Code | Name | What it means |
|---|---|---|
| 301 | Moved Permanently | A permanent move. Google uses it as a strong signal that the new address should be the one it processes.1 |
| 308 | Permanent Redirect | Also permanent. Google says it's equivalent to a 301.1 |
| 302 | Found | A temporary move. Google uses it as a weak signal about the new address.1 |
| 307 | Temporary Redirect | Also temporary. Google says it's equivalent to a 302.1 |
Permanent or temporary
Permanent means "the old address is finished." Temporary means "it's elsewhere right now, but come back to the old address later."
Google's guidance follows that split. Permanent ones put the new target in search results. Temporary ones keep the source page there, which is the old address.2
So Google suggests permanent redirects when you're sure the redirect won't be reverted.2
For a temporary case, Google gives the example of a service that's unavailable for a while. A temporary redirect sends people to a page explaining what's happening, and the original address stays in search results.2
MDN adds that search engine robots and other crawlers don't memorise the new, temporary address.3 That's the point of a temporary redirect. It leaves the old address in charge.
Why there are two of each
The 301 and 302 codes are older. Both leave plain page requests alone. For other kinds of requests, such as a form someone submitted, MDN says they may or may not be changed to a plain page request.3
The 308 and 307 codes were made to remove that doubt. They keep the method and body of the request unchanged.3
If your site is ordinary pages that people read, this rarely comes up. It matters more for sites with forms and logins.
Does the choice matter to Google?
Between a 301 and a 308, Google treats them the same way. The same goes for a 302 and a 307.1
The permanent-versus-temporary choice is the one that counts. A temporary redirect sends Google a weak signal about the new address, and a permanent one sends a strong signal. So a temporary code on a page that's gone for good gives Google less to go on.1
Google still asks you to pick the code that fits. It says the codes are semantically different, meaning they carry different meanings. Its advice is to use the status code that's appropriate for the redirect, so other clients such as e-readers and other search engines can benefit.1
A common trap with default settings
Some tools pick a code for you. On Apache, a common web server, the Redirect directive in the mod_alias module sets up a 302 by default.3 If you meant a permanent move, you'd need to add the permanent keyword or the 301 code.3
Many hosts and site builders hide this behind a form. Look for a choice labelled permanent, and pick it for a lasting move.
Before you edit a server file or a host's redirect settings, save a copy of what's there now. Then follow your own host's help pages for the exact steps. After you save, open the old address in a browser and check that it lands on the right page.
For what to do when a page has no new home at all, see choosing between a redirect and an error.
Reference list
- How HTTP status codes affect Google's crawlers, Google Search Central
- Redirects and Google Search, Google Search Central
- Redirections in HTTP, MDN Web Docs (Mozilla)