301 vs 302 redirects: which one to use
A 301 says a page has moved for good. A 302 says it's somewhere else for now and will come back. Visitors can't tell them apart, but search engines can, and the choice decides which URL appears in search.
The difference
Both send the visitor to another URL. What changes is what search engines do with the two URLs:
- 301 Moved Permanently: Google treats the redirect as a strong signal that the new URL should be the canonical one. Over time the new URL replaces the old one in search results.
- 302 Found: Google follows the redirect but doesn't use it as a canonical signal, so the old URL generally stays in search results. If the redirect stays for a long time and other signals point to the new URL, Google may index the new one anyway.
Google has said that 3xx redirects don't lose PageRank, so the choice isn't about "passing link juice". It's about telling search engines which URL you want them to show.
301, 302, 307 and 308
There are two permanent codes and three temporary ones. Google groups them like this:
| Code | Meaning | Google treats it as | Request method |
|---|---|---|---|
301 | Moved Permanently | Permanent | May change POST to GET |
308 | Permanent Redirect | Permanent | Keeps the method |
302 | Found | Temporary | May change POST to GET |
307 | Temporary Redirect | Temporary | Keeps the method |
303 | See Other | Temporary | Always GET |
For SEO, 301 and 308 are interchangeable, as are 302 and 307. The method difference matters for forms and APIs, not for pages people visit.
Two other kinds of redirect exist. A meta refresh with no delay is treated as permanent, and one with a delay as temporary. JavaScript redirects work only if Google renders the page, so use them only when you can't redirect on the server.
One thing to know about 307: browsers show an "internal" 307 when a site uses HSTS, which upgrades http:// to https:// inside the browser. That 307 never reaches the server or Googlebot, so a checker that requests the URL directly shows the real redirect the server sends.
When to use each
| Situation | Use |
|---|---|
| A page moved to a new URL | 301 |
| Moving to a new domain | 301, page to page |
HTTP to HTTPS, or adding/removing www | 301 |
| Merging two pages into one | 301 from the one you remove |
| A product temporarily out of stock, sending people to a category | 302 |
| A short promotion or seasonal page in front of a permanent one | 302 |
| A/B tests that send part of traffic to a variant | 302 |
The simple rule: if you'll never point the old URL back at its old content, use a permanent redirect. If you will, use a temporary one.
How to check your redirects
Browsers follow redirects silently, so you can't see the code by visiting the page. Use a checker that records each hop and its status:
Paste one URL or thousands. Each result shows every hop's status code and destination, so you can spot:
- moved pages still on
302that should be301; - a mix of
301and302in the same chain; - chains of several redirects, which are worth flattening to one hop. See Redirect chains.
In Search Console, redirecting URLs show up as Page with redirect in the Page indexing report. That's usually expected; the guide to Page with redirect explains when it isn't.
Setting them up
Apache (.htaccess):
Redirect 301 /old-page/ https://www.example.com/new-page/ Redirect 302 /sale/ https://www.example.com/summer-sale/
Nginx:
location = /old-page/ { return 301 https://www.example.com/new-page/; }
location = /sale/ { return 302 https://www.example.com/summer-sale/; }
WordPress: a redirect plugin such as Redirection, or the redirect manager in Yoast SEO Premium or Rank Math, lets you choose the code per redirect. Check the default: some plugins use 302 unless you change it.
Shopify: URL redirects created in the admin are 301s. There's no setting for a temporary one.
In code: many frameworks default to 302. In PHP, header('Location: …') sends a 302 unless you pass 301; Express's res.redirect() also defaults to 302. Set the code explicitly.
Common mistakes
- A 302 left in place for a permanent move, often because it was a framework's default. The old URL may stay in search far longer than intended.
- Redirecting deleted pages to the homepage. Google often treats that as a soft 404. Redirect to the closest equivalent, or let the page return 404.
- Removing redirects too soon. Links from other sites keep pointing at old URLs for years. Keep permanent redirects in place for as long as you can, at least a year.
- Leaving internal links on old URLs. Update links, canonical tags and sitemaps to the new URLs so most visits don't redirect at all.
Questions
Is a 301 or 302 better for SEO?
Neither is better in general; they say different things. Use a 301 when a page has moved for good, so the new URL takes its place in search. Use a 302 when the original URL should stay in search because it's coming back.
What is the difference between 301, 302, 307 and 308?
301 and 308 are permanent; 302 and 307 are temporary. 307 and 308 keep the request method, so a form POST stays a POST, while 301 and 302 may turn it into a GET. Google treats 301 and 308 the same, and 302 and 307 the same.
Does a 302 redirect pass PageRank?
Google has said that 3xx redirects don't lose PageRank. The difference is which URL Google indexes: the target for a 301, usually the original for a 302.
How do I change a 302 to a 301?
Find where the redirect is set, whether that's the server config, a CMS plugin or application code, and change the status code there. Then check the URL again in the Redirect Checker to confirm it now returns 301.