1. Home
  2. Guides
  3. Redirects: 301 vs 302
SEO guide

Redirects explained: 301 vs 302 (and 307, 308)

A redirect sends visitors and search engines from one address to another. Picking the right type, and keeping redirects short, protects your rankings and your speed when pages move, sites switch to https or domains change.

Key points

  • Use a 301 or 308 when a page has moved for good, and a 302 or 307 when the move is temporary.
  • Google treats permanent redirects as a strong hint that the new address should be the canonical one. Temporary redirects are a weaker hint.
  • Every extra hop costs a round trip. Point old addresses straight at the final address and avoid chains and loops.

What a redirect is

When a browser or crawler asks for a URL, the server can answer with a status code in the 300 range and a Location header naming a different address. The client then requests that address instead. The visitor normally sees only the final page, but each hop is a separate request.

The status codes

CodeNameMeaningTypical use
301Moved PermanentlyThe page lives at the new address from now on.Site moves, http to https, merged pages
308Permanent RedirectLike 301, and the request method (such as POST) must not change.Permanent moves of forms or APIs
302FoundTemporarily at another address; keep using the original.Short-term promotions, A/B tests, maintenance pages
307Temporary RedirectLike 302, and the request method must not change.Temporary moves of forms or APIs
303See OtherFetch the result with a GET at another address.After a form submission

How search engines treat them

  • A permanent redirect tells Google that the target should replace the old address in its index. Ranking signals are generally passed to the new address, so a clean 301 does not lose a page's standing by itself.
  • A temporary redirect tells Google to keep the original address indexed. Google has said that a redirect left in place for a long time can end up treated as permanent, but do not rely on that: use the right code from the start.
  • Google follows several hops, but long chains waste crawl effort and can be abandoned. Keep to one hop wherever you can.
  • Redirects written in HTML (meta refresh) or JavaScript can work but are slower and less reliable than a server response. Prefer a server-side status code.

Browsers cache permanent redirects very firmly. If you are testing a new rule, try it as a 302 first and switch to 301 only once it is correct, otherwise a mistake can stick in visitors' browsers.

When to use a redirect

  • Switching to https: send every http:// address to its https:// twin with a 301.
  • Choosing www or non-www: pick one and redirect the other to it, so one version collects all the links.
  • Changing a URL: send the old address to the new page that replaces it, not to the home page.
  • Moving domains: map each old URL to its exact counterpart on the new domain.
  • Deleting a page: redirect only if a closely related page exists. If not, let it return 404 or 410 and see how to handle broken links.

Common problems

  • Chains: A goes to B, which goes to C. Every hop adds a full network round trip before the page can start loading, which slows Largest Contentful Paint. Change A to point at C directly.
  • Loops: A goes to B and B goes back to A. Browsers give up with a "too many redirects" error. A common cause is a CDN or plugin forcing https while the server forces http.
  • Redirecting everything to the home page: search engines may treat this as a soft 404, and visitors lose the page they wanted.
  • Going back to http: a hop from https to http undoes your security setup.
  • Temporary codes for permanent moves: the old address stays indexed and the new one may take longer to replace it.

How to set one up

The method depends on your platform. Look in your host's control panel or CMS first, because plugins and site builders often have a redirects screen. On a server you manage:

# nginx
server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://example.com$request_uri;
}

# Apache (.htaccess)
Redirect permanent /old-page/ https://example.com/new-page/

Keep a list of old and new addresses, and keep the redirects in place for at least a year, or for as long as the old addresses still receive links or visits.

How to check your redirects

  1. Run your address through the redirect checker. It shows each hop, its status code and the final address.
  2. Test all four versions: http://example.com, http://www.example.com, https://example.com and https://www.example.com. Three of them should end on the fourth in a single hop.
  3. Check that the final page returns 200, is not noindex and names itself as its canonical.
  4. After a site move, test a sample of old addresses and confirm your sitemap lists only final addresses.

FAQ

Does a 301 redirect lose ranking?

Not by itself. Google says that redirects do not cause a loss of ranking signals just for being redirects. Rankings can still change after a move if the new page is different or if the redirects are wrong, chained or missing.

What is the difference between 301 and 308?

Both are permanent. A 308 requires the client to repeat the same request method at the new address, while older clients may turn a POST into a GET after a 301. For ordinary web pages the two behave the same.

How long should I keep a redirect?

At least a year for a page move, and indefinitely for important old URLs that still have external links pointing at them. Removing redirects too early sends visitors to errors.

Is a JavaScript or meta refresh redirect bad for SEO?

They can be followed, but they are slower and less dependable than a server redirect, and some crawlers ignore them. Use a 301 or 302 from the server when you can.

Why does my site say too many redirects?

Usually a loop: two rules send the visitor back and forth, for example a CDN forcing https while the origin forces http, or www and non-www rules that contradict each other. Trace the hops to see which two addresses repeat.

WebsiteHealthLabs Editorial
Guides explain audit results in plain English. Facts are checked against public documentation from Google, W3C and the browser vendors, and we update them when guidance changes.

↑ ↓ to moveEnter to openEsc to closeAll results