301 vs 302 redirects: which one to use, and when it matters
A 301 says the move is permanent and passes ranking signals; a 302 says it is temporary. When to use each, how to check yours, and common mistakes.
By Sohail Hussain29 October 20264 min read
Use a 301 when a page has moved for good and you want search engines to transfer its rankings to the new address. Use a 302 only when the old URL is coming back, for example during a sale, an A/B test or a short maintenance window. If you are not sure, the answer is almost always 301.
That is the whole decision. The rest of this guide covers why the distinction still matters, how to check which one your site is sending, and the three redirect mistakes that cost sites the most traffic.
What the two status codes actually tell a browser
A redirect is an HTTP response with a status code in the 300s and a Location header pointing somewhere else. The browser follows it; the visitor rarely notices. The code is a message about intent:
| Code | Meaning | Search engines | Browser cache |
|---|---|---|---|
| 301 | Moved permanently | Index the new URL, pass signals to it | Cached, often for a long time |
| 302 | Found (moved temporarily) | Keep indexing the old URL, at least at first | Not cached by default |
| 308 | Moved permanently, keep the method | Same as 301 | Cached |
| 307 | Temporary, keep the method | Same as 302 | Not cached |
The browser caching column is the one people forget. Because browsers cache 301s, a wrong 301 is painful to undo: visitors who already hit it keep going to the wrong place until their cache expires, even after you fix the server. Test permanent redirects on a staging site before shipping them.
When a 302 is the right choice
- A product page that is out of stock, redirecting to the category for a few weeks.
- A campaign URL that points to this month's landing page and next month's after that.
- A/B tests where some visitors are sent to a variant.
- Geolocation redirects that send visitors to a regional version but must leave the canonical URL indexable.
- Maintenance pages.
In each case the original URL is still the real page. Telling Google it has moved permanently would be a lie, and Google would start dropping the original from the index.
When a 301 is the right choice
- A page renamed or moved to a new path.
- A domain change, including
wwwto non-wwwandhttptohttps. - Merging two pages into one.
- Retiring a page that has a close replacement.
- Trailing-slash and case normalisation, so that
/About/and/aboutresolve to one URL.
A redesign or migration is a long list of 301s. On a WordPress-to-Next.js migration we did for a content site with around 900 URLs, the redirect map was the single largest file in the project and the reason organic traffic was flat through the switch instead of dropping.
How to check which redirect you have
Run this in a terminal, replacing the URL:
curl -sI https://example.com/old-page | head -n 5
The first line shows the status, for example HTTP/2 301, and a location: line shows the destination. Repeat with the destination until you get a 200. If you see more than one hop, you have a chain, covered below.
In the browser, the Network tab in developer tools shows the same thing. Tick "Preserve log" first, or the redirect disappears when the page loads.
How to set each one
Next.js, in next.config.ts. permanent: true sends a 308, false sends a 307:
async redirects() {
return [
{ source: "/old-page", destination: "/new-page", permanent: true },
{ source: "/sale", destination: "/offers/october", permanent: false },
];
}
Apache, in .htaccess:
Redirect 301 /old-page /new-page
Redirect 302 /sale /offers/october
Nginx, in the server block:
location = /old-page { return 301 /new-page; }
location = /sale { return 302 /offers/october; }
WordPress: a plugin such as Redirection, or the rules above in .htaccess. Avoid plugins that implement redirects with JavaScript or meta refresh; search engines treat those as weaker signals.
If you have a list of old and new URLs, our redirect generator turns it into rules in all three formats.
The three mistakes that cost the most traffic
Redirecting everything to the homepage. When a site is rebuilt and the old URLs are sent wholesale to /, Google treats it as a soft 404. The rankings those pages held are lost. Map each old page to its closest new equivalent, and only send to the homepage when nothing close exists.
Redirect chains. http:// to https://, then non-www to www, then /old to /new: three hops before the visitor sees a page. Each hop adds latency and Google follows a limited number before giving up. Point every old URL directly at the final destination, and fix the chain whenever you add a redirect on top of an older one.
Leaving 302s in place for years. A temporary redirect that became permanent by neglect. Google usually works it out eventually, but "eventually" can be months of the wrong URL in results. Audit redirects after any migration and change the ones that are staying to 301.
A quick audit you can run today
- Export your URLs from the sitemap or Search Console.
- Run them through a crawler such as Screaming Frog, or a short script around
curl, and record the status and final destination for each. - Look for chains (more than one hop), loops, 302s older than a month, and 301s pointing at the homepage.
- Fix the destination of each so it reaches a
200in one hop.
If you are planning a redesign or a move between platforms, read our guide on migrating a website without losing SEO, which covers redirect mapping in detail, or see how we handle it as part of a website redesign and migration.
The official reference is Google's documentation on redirects and Google Search, which lists every redirect type it recognises and how each is treated.
Was this guide useful?