Redirect 301 vs. 302
The number isn't a minor technical detail: 301 means "moved permanently," 302 means "moved temporarily," and Google treats each one differently. With a 301, the target URL becomes the canonical version, the one Google shows in search results. With a 302, Google keeps showing the original URL in results for as long as the redirect stays in place, because it assumes the old address could become active again at any point.
| Situation | Correct code | Why |
|---|---|---|
| Domain migration | 301 | The old URL won't be used again |
| Changing a page's URL slug | 301 | The previous address is permanently obsolete |
| A/B test between two page versions | 302 | The original version needs to stay the reference while the test runs |
| Landing page for a seasonal campaign | 302 | The page disappears once the campaign ends, the original URL stays valid |
The costliest mistake is leaving a 302 on a change that's actually permanent. It happens constantly during domain migrations: the new CMS or platform defaults to a 302, nobody double-checks it, and for weeks Google keeps showing the old domain in results instead of consolidating value on the new one. The new domain inherits crawl history and click history more slowly, because as far as Google is concerned, the redirect could still be reversed at any moment.
The practical rule is simple: if there's any real chance the old URL becomes active again, it's a 302. If that chance doesn't exist, it's a 301.
Checking the actual code takes seconds from the command line, regardless of what the CMS or plugin claims:
curl -I https://example.com/old-page
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Protocol and subdomain switches count as 301s too, even when they don't feel like a "migration": moving from http to https, or from a non-www version to www (or the other way around), consolidates permanently onto a single address and should always carry this code, never a temporary 302, and definitely not both versions left standing with no redirect at all.
In practice, the mistake is rarely a deliberate choice for 302, it's the software's default setting. Plenty of redirect plugins and reverse-proxy configurations set a 302 without asking, because it's the safer default: a redirect wrongly marked permanent is harder to undo than one wrongly marked temporary. Anyone who doesn't check after a migration often keeps the wrong code for months without noticing, because the site keeps working fine for visitors. Only the search engine sees the difference.
