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:

CodeMeaningSearch enginesBrowser cache
301Moved permanentlyIndex the new URL, pass signals to itCached, often for a long time
302Found (moved temporarily)Keep indexing the old URL, at least at firstNot cached by default
308Moved permanently, keep the methodSame as 301Cached
307Temporary, keep the methodSame as 302Not 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 www to non-www and http to https.
  • Merging two pages into one.
  • Retiring a page that has a close replacement.
  • Trailing-slash and case normalisation, so that /About/ and /about resolve 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:

bash
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:

ts
async redirects() {
  return [
    { source: "/old-page", destination: "/new-page", permanent: true },
    { source: "/sale", destination: "/offers/october", permanent: false },
  ];
}

Apache, in .htaccess:

apache
Redirect 301 /old-page /new-page
Redirect 302 /sale /offers/october

Nginx, in the server block:

nginx
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

  1. Export your URLs from the sitemap or Search Console.
  2. Run them through a crawler such as Screaming Frog, or a short script around curl, and record the status and final destination for each.
  3. Look for chains (more than one hop), loops, 302s older than a month, and 301s pointing at the homepage.
  4. Fix the destination of each so it reaches a 200 in 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?

Questions

Frequently asked.

Does a 302 lose rankings?

Not immediately, and Google says it treats long-lived 302s as permanent eventually. The risk is the in-between period, where Google keeps indexing the old URL and the new one gathers no signals. If the move is permanent, use a 301 and remove the doubt.

What about 307 and 308?

They are the strict versions: 308 is a permanent redirect that must keep the request method, 307 a temporary one. For a normal GET of a web page they behave like 301 and 302. Next.js uses 308 for permanent redirects by default, and that is fine for SEO.

How long should I keep a 301 in place?

At least a year, and ideally forever. Old links on other sites never get updated, and every one of them is a visitor and a ranking signal you keep only while the redirect exists.

Sohail Hussain

Founder, MSH Technologies

Sohail has designed and built websites, web apps and AI products for over 12 years, for clients from Singapore-based industrial groups to early-stage SaaS startups. He writes about what actually worked.

Keep reading

Related guides.

All posts

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

We reply within a working day. No spam, ever.