Skip to content
Technical SEO

Redirects for SEO: 301, 302, 307 and 308 Explained

12 min readPublished By Sanju Joseph

A redirect sends visitors and search engines from one URL to another. You need them whenever a page moves: a renamed product, a merged blog post, a switch from HTTP to HTTPS, a new domain, a site rebuild. Get redirects right and a move is almost invisible to your rankings. Get them wrong and you can lose traffic that took years to build, because Google keeps visiting the old addresses, finds errors or confusing signals, and has to work out on its own what happened.

This guide is practical. It explains the four status codes that matter (301, 302, 307 and 308), what Google does with each, how to avoid chains and loops, how to plan a migration with a redirect map, and copy-ready configuration for Apache, Nginx, Cloudflare, Vercel and Next.js, Netlify, WordPress and Shopify. It finishes with the redirects you should avoid and a repeatable way to audit them.

The Short Answer: Which Redirect Should I Use?

CodeNamePermanent?Keeps request method?Use it when
301Moved PermanentlyYesNot guaranteed (browsers may turn POST into GET)A page or site has moved for good. The default choice for SEO.
308Permanent RedirectYesYesSame as 301, and the method must be preserved (forms, APIs). Default for permanent redirects on Vercel and Next.js.
302FoundNoNot guaranteedA short-term move: a temporary promotion, an out-of-stock page, A/B testing, maintenance.
307Temporary RedirectNoYesSame as 302 when the method must be preserved. Default for temporary redirects on Vercel and Next.js.

For SEO, the meaningful split is permanent versus temporary. Google's documentation on redirects says that it treats 301 and 308 as permanent, which is a strong signal that the redirect target should become the canonical (indexed) URL, and 302 and 307 as temporary, which is a weaker signal, so Google is more likely to keep showing the original URL in results. The difference between 301 and 308 (or 302 and 307) is about how browsers handle the request method, not about rankings.

Google has also said since 2016 that 3xx redirects do not lose PageRank, so the old worry that a 301 "leaks" some link value is out of date. What can still cost you is a redirect to the wrong place, a slow chain, or a temporary redirect left in place for something that is actually permanent.

A useful rule: if you would be surprised or unhappy to see the old URL come back in Google, use a permanent redirect. If you plan to bring the old URL back, use a temporary one.

How Google Handles Redirects

A few documented behaviours explain most redirect advice:

  • Server-side redirects are the most reliable. Google recommends HTTP redirects returned by the server, because Googlebot sees them on the very first request without rendering anything.
  • Googlebot follows up to 10 redirect hops. Google's crawler documentation says that beyond that, the URL is treated as a redirect error and the content is not fetched. Long before ten, chains slow down crawling and users.
  • Redirects are a canonicalization signal, not a command. Google weighs the redirect alongside other signals like canonical tags, internal links and sitemaps. If your redirect says one thing and your internal links and canonicals say another, Google may not pick the URL you want. Our canonical tags guide explains how those signals combine.
  • Keep permanent redirects in place. For site moves, Google advises keeping redirects for at least a year, and ideally indefinitely, because external links and bookmarks keep sending people to old URLs long after Google has processed the move.

Redirect Chains and Loops

A chain is a redirect that leads to another redirect before reaching the final page. Chains build up naturally over years of changes:

http://example.com/shoes
  → 301 → https://example.com/shoes          (HTTPS migration, 2019)
  → 301 → https://www.example.com/shoes      (www switch, 2021)
  → 301 → https://www.example.com/footwear/  (category rename, 2024)
  → 200

Each hop adds a round trip for visitors and extra work for crawlers. The fix is to point every old URL directly at the final destination, and to update internal links so they never touch a redirect at all.

A loop is a chain that comes back on itself (A → B → A). Browsers give up with an error such as "too many redirects" and Google cannot reach the content. Loops usually come from conflicting rules: an HTTPS rule at the CDN fighting a different HTTP rule at the origin, or a trailing-slash rule fighting a CMS setting.

You can see a chain from any terminal with curl:

curl -sIL http://example.com/shoes | grep -iE "^(HTTP|location)"

Or paste the URL into the redirect chain checker, which shows every hop, its status code and where the chain ends. To check the final status of a list of URLs, use the HTTP status code checker.

Planning a Migration With a Redirect Map

Site migrations (new domain, new CMS, new URL structure, HTTPS) are where redirects make or break SEO. The core artifact is a redirect map: a list of every old URL and the single best new URL for it.

Step 1: Inventory every old URL

Combine several sources, because no single one is complete: a full crawl of the current site, your XML sitemaps, the Pages report in Google Search Console, your analytics landing pages for the past year, and URLs with external backlinks from your link tool. Old URLs that only exist in backlinks are easy to forget and often carry the most value.

Step 2: Map each URL to its closest equivalent

Map one to one wherever possible: old product page to new product page, old article to new article. Where content is consolidated (for example, when merging pages that competed for the same keyword, as described in our keyword research guide), point the old URLs to the page that now covers the same topic. Avoid the shortcut of sending everything to the homepage; Google's documentation says redirecting to an irrelevant page, such as the homepage, may be treated as a soft 404, which means the old page's signals are dropped anyway.

old_url,new_url,status
/products/trail-runner-2,/shop/running/trail-runner-2,301
/products/trail-runner-1,/shop/running/trail-runner-2,301
/blog/2019/05/how-to-lace-shoes,/guides/how-to-lace-running-shoes,301
/about-us.html,/about/,301
/summer-sale,/sale/,302

If your URLs change by a predictable pattern (for example /blog/2019/05/slug becoming /guides/slug), build the old-to-new list with a find-and-replace in a spreadsheet, and the redirect rule generator turns pairs of URLs into ready-to-paste .htaccess or Nginx rules.

Step 3: Decide what should not be redirected

Pages that are gone for good with no equivalent (a discontinued product with no replacement, an outdated event) should return 404 Not Found or 410 Gone. Both tell Google to drop the URL; 410 is slightly more explicit. Returning a real 404 is far better than a forced redirect to an unrelated page.

Step 4: Launch and update everything else

  • Update internal links, navigation, canonical tags and hreflang to point to the new URLs directly. Our internal linking guide covers finding and fixing these at scale.
  • Submit new XML sitemaps that list only final URLs. See the XML sitemap guide, and check the result with the sitemap validator.
  • For a domain change, verify both domains in Search Console and use the Change of Address tool from the old property.
  • Ask the owners of your most valuable backlinks to update their links to the new URLs.
  • Test a large sample of old URLs immediately after launch, then monitor Search Console's Page indexing report and crawl errors for several weeks.

Redirect Configuration, Platform by Platform

Use whichever layer you control closest to the edge, and keep all redirect rules in one place if you can. Rules scattered across a CDN, a server config and a CMS plugin are how loops happen.

Apache (.htaccess)

For single pages, the Redirect directive from mod_alias is the simplest option:

Redirect 301 /old-page /new-page
Redirect 301 /about-us.html https://www.example.com/about/
Redirect 302 /summer-sale /sale/

For patterns and site-wide rules, use mod_rewrite. This block forces HTTPS and the non-www host in one hop, which avoids a two-step chain:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

# Pattern: /blog/2019/05/my-post → /guides/my-post
RewriteRule ^blog/[0-9]{4}/[0-9]{2}/(.+)$ /guides/$1 [L,R=301]

Order matters: Apache processes rewrite rules from top to bottom, so put specific rules before general ones. Avoid mixing Redirect and RewriteRule for the same URLs, since the two modules run independently.

Nginx

# Whole host: HTTP and www → https://example.com, one hop
server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name www.example.com;
    # ssl_certificate lines here
    return 301 https://example.com$request_uri;
}

# Inside the main server block for example.com:
location = /old-page { return 301 /new-page; }
rewrite "^/blog/\d{4}/\d{2}/(.+)$" /guides/$1 permanent;   # permanent = 301, redirect = 302

Nginx needs the quotes around any regular expression that contains curly braces, otherwise it fails to parse the config. Run nginx -t before reloading.

For hundreds or thousands of one-to-one redirects, a map is faster and tidier than a long list of location blocks:

# In the http {} context
map $uri $redirect_target {
    default "";
    /products/trail-runner-1  /shop/running/trail-runner-2;
    /about-us.html            /about/;
}

# In the server {} block
if ($redirect_target) {
    return 301 $redirect_target;
}

Cloudflare

Cloudflare offers Single Redirects (Rules → Redirect Rules) for individual or pattern-based rules and Bulk Redirects for large lists of one-to-one URL redirects uploaded as a list. Page Rules are the legacy way and Cloudflare has been moving users to the newer Rules products. A typical wildcard rule to move www to the apex domain:

Rule type:        Single Redirect
When incoming requests match:  Wildcard pattern
  Request URL:    https://www.example.com/*
Then:
  Target URL:     https://example.com/${1}
  Status code:    301
  Preserve query string: On

Because Cloudflare answers at the edge, these redirects never reach your origin server. That is fast, but it also means an origin rule that disagrees with a Cloudflare rule can produce a loop. A classic case is the SSL/TLS mode set to "Flexible" while the origin forces HTTPS: Cloudflare connects to the origin over HTTP, the origin redirects to HTTPS, and the cycle repeats.

Vercel and Next.js

On Vercel, redirects can live in vercel.json. Note that "permanent": true returns 308 and false returns 307; Google treats 308 the same as 301 for indexing.

{
  "redirects": [
    { "source": "/old-page", "destination": "/new-page", "permanent": true },
    { "source": "/blog/:year/:month/:slug", "destination": "/guides/:slug", "permanent": true },
    { "source": "/summer-sale", "destination": "/sale", "permanent": false }
  ]
}

In a Next.js app, the same rules can go in next.config:

// next.config.ts
const nextConfig = {
  async redirects() {
    return [
      { source: "/old-page", destination: "/new-page", permanent: true },
      { source: "/blog/:slug*", destination: "/guides/:slug*", permanent: true },
    ];
  },
};
export default nextConfig;

Inside server code, Next.js has redirect() (307 by default) and permanentRedirect() (308). Use the permanent one for any URL change you want Google to consolidate.

Netlify

Netlify reads a plain-text _redirects file in the publish directory (or [[redirects]] blocks in netlify.toml). If you omit the status, Netlify uses 301.

/old-page              /new-page            301
/blog/:year/:month/:slug  /guides/:slug     301
/summer-sale           /sale                302

WordPress

WordPress already redirects posts automatically when you change their slug (it remembers the old one), but that does not cover pages moved between sections, deleted content or domain changes. Options, from simplest:

  • A redirect plugin. The free Redirection plugin is widely used, and SEO plugins such as Rank Math and Yoast (in its premium version) include redirect managers. They also log 404s so you can catch missing redirects.
  • Server rules. On Apache hosting, the .htaccess rules above sit before the WordPress block. Server rules run before PHP loads, so they are faster than plugin redirects.
  • Code. For custom logic in a theme or plugin:
add_action( 'template_redirect', function () {
    if ( is_page( 'old-page' ) ) {
        wp_safe_redirect( home_url( '/new-page/' ), 301 );
        exit;
    }
} );

Pick one method for each kind of redirect. A plugin redirect, an .htaccess rule and a hosting-panel redirect for the same URL is a recipe for chains.

Shopify

Shopify manages redirects in the admin under URL redirects (search "URL redirects" in the admin search bar if the menu has moved). Things to know:

  • When you edit a product, collection or page handle, Shopify offers a checkbox to create a redirect from the old URL. Leave it ticked.
  • You can bulk import redirects as a CSV with "Redirect from" and "Redirect to" columns, which is ideal for migrations from another platform.
  • Shopify URL redirects only trigger when the old path no longer exists. If a live page still sits at the old URL, the redirect will not fire.
  • Shopify's URL structure (/products/, /collections/, /pages/, /blogs/news/) is fixed, so migrations onto Shopify almost always require a full redirect map.

Redirects to Avoid

Meta refresh

<meta http-equiv="refresh" content="0; url=https://example.com/new-page">

Google's documentation says it treats an instant meta refresh as a permanent redirect and a delayed one as temporary. It works, but it is slower than a server redirect, can confuse users and accessibility tools, and is not supported in the same way by all crawlers. Use it only when you have no access to server configuration, such as on some static hosting.

JavaScript redirects

window.location.replace("https://example.com/new-page");

Google can follow JavaScript redirects, but only after rendering the page, which happens later than the first crawl and is not guaranteed. Other search engines and many AI crawlers do not render JavaScript at all. Use a server redirect wherever possible and keep JavaScript redirects as a last resort.

Redirecting everything to the homepage

When hundreds of deleted pages all redirect to the homepage, Google is likely to treat those redirects as soft 404s. Visitors do not find what they wanted either. Redirect to the closest relevant page, or return a 404 or 410.

Soft 404s

A soft 404 is a page that says "not found" (or is essentially empty) but returns a 200 OK status. Google flags these in Search Console because they waste crawl budget and send mixed signals. They often appear after a migration when a CMS shows a friendly "page not found" template with the wrong status code. Check suspect URLs with the soft 404 detector, and make sure genuinely missing pages return a real 404 or 410.

Temporary redirects left in place for years

A 302 that has been live for three years is almost certainly meant to be permanent. Google may eventually treat a long-standing temporary redirect as permanent, but there is no reason to leave it guessing. Switch it to a 301 or 308.

Browser "redirects" that are not really yours

If you see a 307 Internal Redirect from HTTP to HTTPS in Chrome DevTools, that is the browser applying your HSTS policy before the request even leaves the machine. It is not a redirect your server sent, and Googlebot does not see it. You still need a real server-side 301 from HTTP to HTTPS. The HSTS checker confirms your policy, and our security headers guide explains how HSTS works.

Auditing Your Redirects

Redirects are not "set and forget". Run this audit after any migration and at least a couple of times a year:

  1. Find internal links that hit redirects. Crawl the site and list every internal link whose target returns a 3xx. Update each link to point to the final URL. The broken link checker also catches links to pages that now return errors.
  2. Find chains and loops. Test old URLs, especially those with backlinks, with the redirect chain checker. Collapse every chain to a single hop.
  3. Check permanence. Every redirect should be deliberately permanent or deliberately temporary. Review any 302 or 307 that has been in place for more than a few months.
  4. Check that targets are indexable. A redirect to a page that is noindex, blocked by robots.txt, or canonicalised elsewhere sends conflicting signals. The canonicalization audit checks the HTTP/HTTPS, www and trailing-slash variants together.
  5. Clean your sitemap. Sitemaps should list only final, 200-status URLs. Search Console's Page indexing report shows "Page with redirect" for URLs Google found that redirect; a few is normal, but sitemap URLs should not be among them.
  6. Watch 404s. Search Console and your server or plugin logs show URLs people and bots are still requesting. High-traffic or well-linked 404s deserve a redirect to their closest equivalent.

A full site audit runs most of these checks across the whole site at once, and the redirect section of the technical SEO checklist (or the interactive SEO checklist) keeps them on your regular to-do list.

Frequently Asked Questions

Is a 301 or 308 better for SEO?

For rankings they are equivalent; Google treats both as permanent. The difference is technical: 308 guarantees the browser keeps the request method (a POST stays a POST), which matters for forms and APIs. Use whatever your platform produces for permanent redirects, as long as it is one of the two.

Do redirects lose link equity?

Google has said that 3xx redirects do not lose PageRank. In practice, losses come from redirecting to an irrelevant page, from long chains, or from removing redirects too early, not from the redirect itself.

How long should I keep redirects after a migration?

Google recommends at least a year and ideally indefinitely. External links, bookmarks and old emails keep sending people to old URLs for many years, so there is little reason to ever remove a permanent redirect that is still being used.

Can I redirect a page that has a penalty or bad links?

Redirecting a page passes its signals, good and bad, to the target. If a page has a manual action or a toxic link profile, it is usually safer to let it return a 404 or 410 and build the new page fresh rather than redirect it.

Should I use a redirect or a canonical tag?

Use a redirect when the old URL should no longer be visited at all. Use a canonical tag when both URLs need to stay accessible to users (for example, sorted or filtered versions of a page) but only one should be indexed. The canonical checker shows which one a page currently declares.

How many redirects is too many?

There is no limit on the number of redirect rules a site can have; large sites have tens of thousands. The limit that matters is hops per request: aim for one. Googlebot stops after 10 hops, and every hop before that slows visitors down.