301, 302, 307 or 308: choosing the right redirect
Permanent or temporary, what each means for your search rankings, and how to find redirect chains and loops.
A redirect sends visitors and search engines from one URL to another. Pick the right type and a moved page keeps its search rankings. Pick the wrong one, or chain several together, and you can lose traffic without noticing.
The four status codes
| Code | Meaning | Use it when |
|---|---|---|
| 301 | Moved permanently | A page or site has moved for good. |
| 308 | Permanent redirect | The same, when the request method must be kept (a form POST stays a POST). |
| 302 | Found, a temporary redirect | A page is somewhere else for now and will come back. |
| 307 | Temporary redirect | The same as 302, with the method kept. |
For ordinary web pages, 301 and 308 behave the same in browsers, and so do 302 and 307. The difference only matters for forms and APIs.
Permanent or temporary: what search engines do
A permanent redirect tells Google the new URL replaces the old one. Google moves the old page's ranking signals to the new address and, over time, shows the new URL in its results.
A temporary redirect says the old URL is still the real one, so Google keeps showing it. If a "temporary" redirect stays in place for a long time, Google may eventually treat it as permanent anyway, but there's no reason to rely on that. If a move is permanent, say so with a 301.
Typical uses for a 301:
- Moving from
http://tohttps://. - Choosing between
www.example.comandexample.com, and redirecting the other one. - Changing a page's URL, or merging two pages into one.
- Moving to a new domain.
Typical uses for a 302:
- A product that's out of stock for a while, sending people to its category.
- A short-lived maintenance or event page.
Chains and loops
A redirect chain is a redirect that leads to another redirect: http://example.com to https://example.com to https://www.example.com to https://www.example.com/home. Each hop adds a delay for visitors, and Google's crawler stops following after about ten. Point every old URL straight at its final destination.
A redirect loop is a chain that comes back to a URL it has already visited. Browsers give up and show an error. Loops usually come from two rules fighting each other, such as one adding www and another removing it, or a plugin and the server both forcing HTTPS in different ways.
Redirects that aren't really redirects
Some pages redirect with a meta refresh tag or with JavaScript. Search engines usually follow them, but they're slower, and weaker signals than a proper status code from the server. Use a server redirect whenever you can.
Check your redirects
The URL redirect checker follows a URL hop by hop, up to ten, and shows each status code, so you can spot chains, loops and temporary redirects that should be permanent. Try it on the four versions of your home page, with and without www, on both http:// and https://. All four should end at the same URL, in one hop at most. To see every header of the final response, use the HTTP headers lookup.
Try it
More posts
What a DNS lookup tells you about a domain
A, MX, TXT, CNAME and the other DNS records explained: what each one does, and what to check when a website or email stops working.
Read post →
How to check an SSL certificate, and what the details mean
Issuer, validity, covered names and the chain: how to read a certificate, and the errors that make browsers show a warning.
Read post →
PNG, JPG, WebP or GIF: choosing the right image format for the web
Which format to use for photos, logos, screenshots and animations, and how much lighter WebP can make your pages.
Read post →