301 vs 302 redirect: choosing the right one when pages move
Use a 301 (or 308) when a page has moved for good: search engines transfer the old address's standing to the new one and show the new URL. Use a 302 (or 307) when the move is temporary and the old address should stay in results. Most site changes are permanent, so most redirects should be 301s.
What a redirect is
A redirect is a server's reply that says "this isn't here, go there": an HTTP status code in the 300s plus a Location header with the new address. The browser follows it straight away, so a visitor barely notices. Search engines notice a great deal, because the status code tells them whether to replace the old URL in their index or keep it. The 301 vs 302 redirect choice is really a choice about that instruction.
The four codes side by side
| Code | Meaning | Method kept? | Search engines |
|---|---|---|---|
| 301 | Moved permanently | Usually, but older clients may switch POST to GET | Index the new URL |
| 308 | Permanent redirect | Yes, always | Index the new URL |
| 302 | Found (temporary) | Usually, with the same caveat as 301 | Keep the old URL in results |
| 307 | Temporary redirect | Yes, always | Keep the old URL in results |
Google's redirects documentation says permanent redirects make the target the canonical URL, and temporary ones generally leave the source in results. The method column matters for forms and APIs rather than ordinary pages: MDN's 308 reference notes that 308 guarantees a POST stays a POST, which 301 doesn't in older clients. For moving web pages, 301 and 308 are interchangeable.
Which one, for which job
- Renamed a page or changed its URL
- 301 from the old path to the new one.
- Moved to a new domain
- 301 from every old URL to its equivalent on the new domain, page for page.
- Chose between www and the bare domain
- 301 from the one you don't use to the one you do.
- Switched from http to https
- 301, usually set once for the whole site by the host.
- A product is out of stock for a fortnight
- 302 to a related page, or better, leave the page up and say when it's back.
- Showing a maintenance page for an hour
- Not a redirect at all: a 503 status with a short message tells crawlers to come back.
- A page is gone with no replacement
- A 404 or 410, not a redirect to the home page.
Moving a site without losing traffic
- List every old URL that matters: from the old sitemap, Search Console's Pages report and your analytics. Include PDFs and image URLs that other sites link to.
- Map each one to its closest new page in a two-column sheet. Old service page to new service page, not to the home page.
- Set the redirects where the old URLs live. For a domain change, that's the old host or the old domain's DNS or registrar redirect service, which must stay paid for and running.
- Point each redirect at the final address, not at another redirect. Chains slow visitors and can be dropped by crawlers after a few hops.
- Update your own links, sitemap and profiles to the new URLs so the redirects are a safety net, not the main route.
- Use Search Console's Change of Address tool if the domain changed, after verifying both domains.
- Keep the redirects. Google's site move guidance suggests at least a year; longer is better, since old links and bookmarks never fully go away.
Check that a redirect works
Run curl -I https://old.example.com/page in a terminal. The first line shows the status, such as HTTP/2 301, and the location: line shows the destination. Add -L to follow the whole chain and see every hop. Browser developer tools show the same in the Network panel with Preserve log turned on. Then confirm in Search Console's URL Inspection that the new URL is the one Google selected.
Common mistakes
- Using 302 for a permanent change because it was the default in a hosting panel. The old URL lingers in results for months.
- Redirecting everything to the home page. Google's site-move guidance advises against sending many old URLs to one unrelated page, and visitors lose the thing they came for.
- Meta refresh or JavaScript redirects. They work in a pinch, but a server-side redirect is read most reliably.
- Letting the old domain expire. The redirects vanish with it, and someone else can register the name.
Redirects and Anticode
When you move a site to Anticode, the redirects belong on the old host or domain, since that's where the old URLs are requested. Anticode doesn't redirect between www and the bare domain for a custom domain, so connect the one you want people to use and set the other to redirect at your DNS provider if it offers forwarding; www vs non-www covers the choice. Changing a site's anticode.dev address takes the old one down rather than redirecting it, so update links and profiles when you do. For larger moves, the move-a-domain workflow lays out the order of work.
Questions people ask
Do 301 redirects lose ranking?
Google treats a permanent redirect as a strong signal that the new URL replaces the old one. Expect a short settling period while it recrawls, not a permanent loss, as long as each old page maps to a genuine equivalent.
Can I undo a 301?
Yes, by removing it, but browsers cache permanent redirects, so returning visitors may still be sent to the new URL for a while. Use a 302 while you're unsure.
Is 308 better than 301?
For pages, they're treated alike. Use 308 when a redirected POST must stay a POST, such as an API endpoint or a form handler.