Use a 301 redirect when a page has moved for good and you want the new URL to show in search results. Use a 302 when the move is temporary and you want the original URL to stay. Google treats the two as different signals about which URL should be canonical.
What is the difference between a 301 and a 302?
A redirect is a server response that sends a visitor or crawler from one URL to another. The number tells them how long to expect the arrangement to last.
- 301 (moved permanently): the old URL is gone and the new one replaces it.
- 302 (found, temporary): the old URL is still the real one for now.
Two newer codes work the same way for search. 308 is the permanent counterpart and 307 the temporary one. Both keep the request method unchanged, which matters for form submissions and APIs, not for ordinary pages.
How does Google treat each one?
Google's redirect documentation is direct about it. Permanent redirects (301 and 308) are a signal that the redirect target should be canonical, so Google shows the new target in search results. Temporary redirects (302, 303 and 307) show the source page in search results instead.
Google also notes that other canonicalization signals can still lead to the target being indexed. A redirect is a strong hint, not the only input. If you want to understand the wider canonical picture, see our guide on sitemaps, which should list only the URLs you want indexed.
Which should you use?
| Situation | Use |
|---|---|
| You changed a URL and will not change it back | 301 or 308 |
| You moved to a new domain | 301 or 308 |
| You merged two pages into one | 301 or 308 from the weaker page |
| HTTP to HTTPS, or www to non-www | 301 or 308 |
| A short sale or maintenance page | 302 or 307 |
| A/B test sending some visitors elsewhere | 302 or 307 |
The rule is about intent. Google advises using a permanent redirect when you are sure the redirect will not be reverted. If you are unsure, ask whether you would ever bring the old URL back. If yes, it is temporary.
Common mistakes
- Leaving a 302 in place for months. Many platforms default to 302. A move you meant to be permanent then sends the wrong signal. Check the status code, not just that the page loads.
- Redirect chains. A to B to C wastes crawl effort and slows visitors. Point each old URL straight at the final one.
- Redirecting everything to the homepage. Send each old page to the closest equivalent. If there is none, a 404 is more honest.
- Using JavaScript when a server redirect is possible. Google says to use JavaScript redirects only if you cannot use server-side or meta refresh redirects, and warns it might never see one if rendering fails.
- Removing redirects too soon. In its site move guidance, Google says to keep redirects as long as possible, generally at least one year.
How to check a redirect
Run curl -I https://example.com/old-page and read the first line of the response. You want to see 301 or 308 for a permanent move, along with a location header holding the new URL. Then test the new URL to confirm it returns 200 and not another redirect. In Search Console, the URL Inspection tool shows which URL Google chose as canonical. Our guide to checking if a page is indexed walks through it.
Frequently Asked Questions
Does a 301 redirect lose ranking?
Google does not say a redirect on its own causes a penalty. It treats a permanent redirect as a signal to use the new URL as canonical. Slow, chained or irrelevant redirects are the usual cause of problems.
Is a 302 ever fine for a permanent move?
Google says other canonicalization signals can still lead to the target being indexed, but its documentation says temporary redirects show the source page. Use the permanent code so you do not depend on that.
What is the difference between 301 and 308?
Both are permanent. 308 keeps the original request method, such as POST. For normal page moves, either works for search.
Is a meta refresh a redirect?
Yes. Google says an instant meta refresh is treated as permanent and a delayed one as temporary. Server-side redirects are the more reliable choice.
How long should I keep a redirect?
Google says generally at least one year, and suggests that keeping redirects indefinitely may be better for users.