Blog · SEO

301 Redirects: When to Use Them, How to Set Them Up and How to Check Them

A 301 tells browsers and search engines that a URL has moved for good. This guide covers the redirect types and how Google treats each, the four host versions every site should merge, chains and loops, server examples for Apache, Nginx and Next.js, and how to fix every problem a redirect checker reports.

Searvia · 10/24/2026 · 13 min read

In short: A 301 redirect tells browsers and search engines that a URL has moved permanently. Google treats 301 and 308 as a strong signal that the target should be the canonical URL; 302 and 307 are temporary and leave the old URL in place. Every site should answer on one address only: http://, https://, www and non-www must all redirect to the same final URL, in one hop. Keep redirects for at least a year, update internal links to the final address, and check the whole chain, not just where it ends.

Redirects are invisible when they work. When they don't, the symptoms are vague: rankings split between www and non-www, a migration that loses traffic for months, a home page that takes an extra second to load because it bounces through three addresses. Most of these problems can be found in a minute by following each version of your address to its end.

This guide covers the redirect types and how Google treats them, the host versions every site must merge, chains and loops, setup on common servers, how our free redirect checker works and how to fix each problem it reports.

What a redirect is

A redirect is a response that says "this resource is somewhere else" and names the new address in a Location header. The browser requests the new address automatically. A server-side redirect looks like this on the wire:

HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/new-page

The status code tells clients how to treat the move. MDN splits them into permanent redirects, after which crawlers "will update the original URL," and temporary ones, which crawlers "don't memorize."

CodeMeaningMethod on non-GET requestsHow Google treats itUse it for
301Moved PermanentlySome clients change POST to GETPermanent: target becomes canonicalMoved pages, merged hosts, HTTP to HTTPS
308Permanent RedirectMethod and body keptPermanentSame as 301; also forms and APIs
302FoundSome clients change POST to GETTemporary: source may stay in resultsShort-term moves, A/B tests
303See OtherChanged to GETTemporaryAfter a form submission
307Temporary RedirectMethod and body keptTemporaryShort-term moves with non-GET requests

Google's redirects documentation also classifies an instant meta refresh (0 seconds) and a JavaScript location change as permanent, and a delayed meta refresh as temporary. It recommends server-side permanent redirects whenever possible and says to "only use JavaScript redirects if you can't do server-side or meta refresh redirects," because rendering can fail.

Why redirects matter for SEO

They consolidate duplicates. Google's canonicalization guide lists redirects as "a strong signal that the target of the redirect should become canonical." Without them, signals such as links can be split across several URLs for the same content.

They carry moved pages through a migration. When URLs change, a 301 from each old URL to its new equivalent tells Google to swap them in the index and sends visitors from old links to the right page.

They protect HTTPS. Google "prefers HTTPS pages over equivalent HTTP pages as canonical," and the same guide lists an HTTP-to-HTTPS redirect as one way to reinforce that.

They cost time. Every hop is another round trip before the page starts loading. On mobile networks, a chain of three redirects is a noticeable delay before anything appears.

One site, one address

To a crawler, these are four different sites, even if they show the same page:

http://example.com/
http://www.example.com/
https://example.com/
https://www.example.com/

Pick one, usually the HTTPS version with or without www, and make the other three answer with a single 301 straight to it. The choice between www and non-www is a matter of taste; what matters is that only one version answers with 200. Also make sure the TLS certificate covers both example.com and www.example.com, or the https://www redirect fails before it can run.

The same rule applies inside the site: if /pricing and /pricing/ both answer 200, pick one form and redirect the other.

Chains and loops

A chain is a redirect that leads to another redirect. The most common one is protocol and host handled in separate steps:

http://www.example.com/  301 →  https://www.example.com/  301 →  https://example.com/

Google's crawlers "follow up to 10 redirect hops" (HTTP status codes and Google Search), so a two-hop chain will not lose the page. But Google's site move guide says to "avoid chaining redirects" and redirect "to the final destination directly"; if that is not possible, keep chains short, "ideally no more than 3 and fewer than 5." Visitors pay for every hop either way.

A loop is a chain that never ends: A redirects to B and B back to A, often because an HTTPS rule on the server and another on the CDN disagree. MDN notes that browsers detect loops and show an error, so the page is simply unreachable.

How to set up a 301 redirect

Apache (.htaccess or virtual host), merging all versions into https://www.example.com:

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

For a single page, Redirect 301 /old-page https://www.example.com/new-page is enough. Note that a bare Redirect without a code sends a 302 by default, per MDN.

Nginx, with one server block catching every other version:

server {
    listen 80;
    listen 443 ssl;
    server_name example.com www.example.com;
    # ssl_certificate lines here for the 443 listener
    if ($host = example.com) { return 301 https://www.example.com$request_uri; }
    if ($scheme = http)      { return 301 https://www.example.com$request_uri; }
    # ... the site itself
}

Many setups use separate server blocks instead; either works as long as each version reaches the final address in one step.

Next.js, in next.config.js:

module.exports = {
  async redirects() {
    return [
      { source: '/old-blog/:slug', destination: '/blog/:slug', permanent: true },
    ]
  },
}

The Next.js docs note that permanent: true sends a 308 and permanent: false a 307, to preserve the request method. Google treats 308 as permanent, so this is fine.

CDNs and hosts. Most CDNs and hosting panels offer redirect rules and an "always use HTTPS" switch. Use one layer for each job: if the CDN upgrades HTTP to HTTPS and the origin server also redirects hosts, you get a two-hop chain, or a loop if the two disagree.

WordPress. The site address in Settings › General decides the canonical host; WordPress redirects other hosts to it. For page-level redirects use a redirect plugin or your SEO plugin's redirect manager, and prefer server rules for the host merge.

How the Searvia redirect checker works

The redirect checker uses the same engine as our website SEO checker: enter a domain and it audits your home page and the files around it with 38 checks in about 20 seconds, showing the three checks this tool is about first. Here is what they do.

Redirects and duplicate versions (medium priority). The checker takes the domain you entered, strips www., and opens four addresses: http:// and https://, each with and without www. It follows each one through up to six redirects and records where it ends and the status code of every hop. A version passes if it ends on the same scheme and host as your home page's final address using only permanent (301 or 308) redirects. The result:

The report lists each of the four versions with its final URL, the redirect codes along the way (for example 301 › 301) and a check or a cross. Versions that do not resolve or cannot be reached, for example a www host with no DNS record, are left out instead of failing.

HTTPS (high priority). It requests http:// plus your host without following redirects. It passes if the site works over HTTPS and the HTTP request answers with a 3xx whose Location starts with https://. It fails with "HTTP does not redirect to HTTPS" or "The site does not work over HTTPS." If plain HTTP does not answer at all, the redirect cannot be tested, and the check shows a note instead of a pass or a failure.

Page status (high priority). The final page must answer with a 2xx status. A 4xx or 5xx fails.

What it does not test

To see every hop with its URL and code:

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

Reading the result

MessageWhat it meansFix
All versions of the address lead to one URL.Every reachable version ends on your main site with permanent redirectsNone
Some versions of the address do not redirect to the main one.At least one version answers on its own or ends elsewhereStep 1
N versions use a temporary redirect (302, 303 or 307); use a permanent 301 or 308.A hop on the way is temporaryStep 6
URL ends in a redirect loop. / URL goes through more than 6 redirects.A version never reaches a pageStep 6
The address goes through N redirects; link to the final address.Your main address bounces more than onceStep 2
HTTP does not redirect to HTTPS.Plain HTTP answers with a page instead of redirectingStep 3
The site does not work over HTTPS.No working HTTPS responseStep 4
The page answers with status N.The final page is not 2xxStep 5

The overall grade covers all 38 checks, weighted by priority (high 10, medium 5, low 2; a warning earns half), with a "Fix these first" list and a shareable report link.

How to fix every problem the checker reports

1. Some versions do not redirect to the main one

2. The address goes through several redirects

3. HTTP does not redirect to HTTPS

4. The site does not work over HTTPS

Install a certificate (Let's Encrypt is free, and most hosts automate it), make sure it covers every host name you use, then add the HTTP-to-HTTPS redirect from step 3. Mixed content, meaning scripts or images still loaded over http://, is the next thing to clean up.

5. The home page does not answer with 200

A 5xx means a server problem; check error logs. A 403 often means a firewall or bot protection is refusing automated requests, which may be refusing search crawlers too. A 404 on the home page usually means a redirect sends visitors to a path that no longer exists. Fix the target, then recheck.

6. Temporary redirects, loops or long chains

Redirects during a migration

When URLs change, the host-level rules above are only the start. Google's site move guidance adds:

For international sites, one more rule from Google: avoid automatically redirecting visitors between language versions based on their location or browser language, because "the Googlebot crawler usually originates from the USA" and may never see the other versions (multi-regional sites). Our hreflang guide covers the alternative.

Worked example (hypothetical)

The following is a hypothetical example, not real data. Bramble & Co, an invented furniture shop, moved to a new platform. The redirect checker reports:

VersionEnds on (codes)OK
http://bramble.example/https://www.bramble.example/ (302 › 301)No
http://www.bramble.example/https://www.bramble.example/ (301)Yes
https://bramble.example/https://bramble.example/No
https://www.bramble.example/https://www.bramble.example/Yes

The https:// bare domain answered with the full site instead of redirecting: the new platform served both hosts, and only the old server had the host rule. The codes also showed that http://bramble.example/ took two hops and that the first one was a 302. The team added a single 301 rule at the CDN for every non-final version, removed the platform's own HTTPS redirect to avoid a chain, and reran the check: all four versions now end on https://www.bramble.example/ in one hop.

A 15-minute redirect checklist

How Searvia helps

The free redirect checker follows every version of your address and checks HTTPS and the home page status in one shareable report. In a Searvia account, the site audit crawls the whole site every week and flags internal links that point to redirects, redirected or broken URLs in the sitemap and pages that return errors, so you can link straight to final addresses everywhere. Uptime monitoring checks your site around the clock and warns you when it goes down or its certificate is about to expire, which is when HTTPS redirects most often break. For the full order of technical checks, see our technical SEO audit guide.

Frequently Asked Questions

What is a 301 redirect?
A 301 redirect is an HTTP response with status 301 Moved Permanently and a Location header that points to a new URL. Browsers go to the new address automatically, and search engines treat it as a permanent move: Google says it uses a permanent redirect as a signal that the target should be the canonical URL, so the new address replaces the old one in results.
What is the difference between a 301 and a 302 redirect?
A 301 is permanent and a 302 is temporary. Google treats 301 and 308 as a strong signal that the redirect target should be canonical, while with 302, 303 and 307 the original URL may stay in search results. Use a 301 or 308 when a page has moved for good, and a 302 or 307 only when the original URL will come back.
Should I use 301 or 308?
For search engines both are permanent redirects and are treated the same way. The difference is for non-GET requests: a 308 keeps the method and body, while with a 301 some clients change a POST into a GET. Use 301 for ordinary page moves; 308 is fine too, and frameworks such as Next.js use it for permanent redirects.
How many redirects in a chain are too many?
Google says its crawlers generally follow up to 10 redirect hops, but its site move guidance says to avoid chaining and redirect straight to the final destination, and if you cannot, to keep chains ideally to no more than 3 and fewer than 5 hops. Every extra hop also slows visitors down, so aim for one.
How long should I keep 301 redirects in place?
Google's site move documentation says to keep redirects for as long as possible, generally at least one year. From a visitor's point of view, keeping them indefinitely is best, because old links in emails, bookmarks and other sites keep working.

Sources

  1. Redirects and Google Search – Google Search Central
  2. How HTTP status codes, and network and DNS errors affect Google Search – Google Search Central
  3. Site moves with URL changes – Google Search Central
  4. How to specify a canonical URL – Google Search Central
  5. Redirections in HTTP – MDN Web Docs
  6. redirects – Next.js documentation
  7. Managing multi-regional and multilingual sites – Google Search Central

Keep Reading