Skip to content
SEO & AI Guides

301, 302, 404 or 410? Redirects and HTTP Status Codes in Site Migrations

What HTTP status codes 301, 302, 404 and 410 mean, when to use each one, and how to avoid redirect chains and soft 404s when migrating a site or changing URLs.

301, 302, 404 or 410? Redirects and HTTP Status Codes in Site Migrations

You changed a page address, deleted a product or redesigned your site — and suddenly traffic drops? The most common cause is not "bad content" but the wrong HTTP status: a page that should have moved reports that it doesn't exist, or the other way around. In language that both a shop owner and a developer can follow, this guide explains exactly what 301, 302, 404 and 410 mean and which one to send in each situation.

When you open an address in your browser, the browser (or Google's crawler) asks a question and the server answers with a three-digit code. That is the HTTP status code. Most people never see these codes, but search engines read them for every URL on your website and use them to decide: index, keep, replace or forget.

Think of the postal service. If you move house, you leave a mail-forwarding instruction (that is a redirect). If the house was demolished and no longer exists, the postman returns the parcel marked "address does not exist" (that is a 404). If the house was deliberately removed for good, that is official confirmation: "it's gone, don't try again" (that is a 410). The wrong label means the mail ends up in the wrong place — and in SEO that means lost rankings.

Redirects and HTTP status codes 301, 302, 404 and 410 – how pages move and disappear

1. What is an HTTP status code and why does SEO need to understand it?

Every server response starts with a status. The first digit tells you which group it belongs to:

GroupMeaningExampleWhat it means for SEO
2xxSuccess200 OKThe page exists and can be indexed
3xxRedirection301, 302, 307, 308Content lives at another address; the type you use matters
4xxClient error404, 410, 403The page can't be retrieved; Google gradually drops it from the index
5xxServer error500, 503The server has a problem; prolonged errors reduce crawl frequency

Three questions matter most for SEO:

  1. Is the address changed permanently or temporarily? (301 or 302)
  2. Is there a replacement page? (redirect or 404/410)
  3. Is the problem on the server side or the content side? (4xx or 5xx)

[!NOTE] The status is the server's response, not what you see on screen. A page can look like "Page not found" while the server sends it 200 OK. This is called a soft 404, and we cover it below.

Which HTTP status to send: 301, 302, 404, 410 or 503 – an overview by situation

2. Redirects: 301, 302, 307 and 308

A redirect automatically sends the visitor and the search engine from an old address to a new one. The difference between types lies in permanence and in what happens to the HTTP method (important for forms and APIs).

StatusNamePermanenceWhen to use it
301Moved PermanentlyPermanentURL change, migration, merging pages, http → https
308Permanent RedirectPermanentSame as 301, but strictly preserves the HTTP method (POST stays POST)
302FoundTemporaryShort-term change, test, seasonal campaign
307Temporary RedirectTemporarySame as 302, with strict preservation of the HTTP method

What does Google do with 301 and 302?

  • 301 / 308 say: "The new URL is the real, permanent one." Over time Google replaces the old URL with the new one in its index and passes signals to it (link authority, relevance).
  • 302 / 307 say: "This is temporary, the old URL is coming back." Google usually keeps the old URL in the index and shows it in results.

Google states that redirects don't by themselves "lose" link value, but the type and consistency are decisive. The most common consequence of a wrong choice isn't a penalty but an unwanted address in search results: if you announce a permanent move with a 302, Google may keep showing the old address for months.

[!TIP] A simple rule: if the old address will never be used again, use 301 (or 308). If it's coming back, use 302 (or 307). When in doubt, it's most likely a permanent change.

What are meta refresh and JavaScript redirects?

A redirect can also be done inside the page (<meta http-equiv="refresh"> or window.location). These work for users but are slower and less reliable for search engines because they only apply after the page has loaded and executed. Whenever you can, use a server-side redirect (a real 3xx status).

3. Which redirect to use in which situation

SituationCorrect solution
You changed the URL of an article or category301 to the exact matching new page
Moving from http:// to https://301 (or 308) to the https version, in a single hop
Choosing www or non-www301 from the unwanted to the preferred version
Domain change (rebranding)301 for every URL to the same path on the new domain
Merging two similar pages301 from the weaker to the stronger page
A product is temporarily unavailable, back in 2 weeksKeep the page with 200, or 302 to a category
Seasonal campaign (e.g. Black Friday landing page)302 to the campaign page, remove it after the campaign
A/B test with different URLs302 (temporary)
Server maintenance503 with a Retry-After header

[!WARNING] Do not redirect all old addresses to the homepage. Google often treats such mass redirects as soft 404s, because the user wants specific content and gets a generic page. Every old URL should go to the closest-matching new page.

4. Status codes 404 and 410: when a page really disappears

404 Not Found: "doesn't exist"

404 means the server finds nothing at that address. This is completely normal and Google doesn't penalize a site for having 404 pages. Every healthy site has them: mistyped links, old URLs, deleted content.

A problem arises only if:

  • pages that should exist return 404 (e.g. a broken link to an important product),
  • many internal links lead to a 404,
  • important pages with many external links end up as 404 instead of a redirect.

410 Gone: "deliberately removed for good"

410 is a more explicit message: "the page was intentionally deleted and is not coming back." In practice Google treats 404 and 410 very similarly, but 410 can remove a URL from the index slightly faster. Use it for content you've knowingly retired: old campaigns, discontinued products without a replacement, spam pages after a clean-up.

What about a discontinued product in an online shop?

SituationRecommendation
A very similar new product exists301 to that product
No replacement, but a relevant category exists301 to the category (not the homepage)
No replacement and no relevant category404 or 410 with a helpful 404 page
The product is coming backKeep the page (200) with an "currently unavailable" note

Soft 404: the most dangerous mix-up

A soft 404 is a page that tells the user "doesn't exist" while returning 200 OK. That's a problem for Google because it can't tell whether the page is real. In Google Search Console such URLs are listed as "Soft 404" and are not indexed.

Typical causes: empty categories with no products, on-site search that returns "0 results" with status 200, a 404 page served with status 200, and mass redirects to the homepage.

[!TIP] A good custom 404 page should return a real 404 status, offer search, links to your most important categories and a clear way back. That turns a lost visitor into a continued conversation.

5. Redirect chains and loops

A redirect chain occurs when A leads to B, B to C, and C to D. It is most often created by several successive redesigns and migrations that nobody "cleaned up".

A three-hop redirect chain versus a direct single-hop redirect

Why are chains bad?

  1. Slowness. Every hop is an extra request to the server, and the visitor waits.
  2. Crawl budget. Googlebot spends time on intermediate steps instead of your new content. More on this in our guide to indexing, crawl budget and the IndexNow protocol.
  3. Risk of breaking. Googlebot follows a limited number of hops (up to 10) and then gives up. Every extra hop raises the risk that the target is never reached.
  4. A bigger chance of error. The longer the chain, the more likely someone breaks it.

A redirect loop (A → B → A) is even worse: the browser shows a "Too many redirects" error (ERR_TOO_MANY_REDIRECTS) and the page is unreachable for everyone.

The rule: every old URL must lead directly to the final destination, in one hop. When you run a new migration, update the old redirects to point to the new target instead of just adding another layer.

6. How to migrate or change a URL safely

A migration (redesign, new CMS, domain change or URL structure change) is the moment when the most traffic is lost. This is a proven order of work:

Before launch

  1. List all existing URLs. Pull them from your sitemap, Google Search Console, analytics and a site crawl. Don't forget pages that have links but no traffic.
  2. Mark the important pages. Sort by traffic, conversions and number of external links. They have absolute priority.
  3. Build a redirect map (a table: old URL → new URL). Every old URL must have the closest-matching new one.
  4. Decide the fate of pages without a replacement. They go to a category or to 404/410.
  5. Test in a staging environment and verify that every redirect leads in one hop to a 200.

On launch day

  1. Activate redirects at the same time as the new site, not afterwards.
  2. Update internal links to point to the new URLs (don't rely on redirects for your own links).
  3. Update canonical, hreflang and the XML sitemap so they contain only new addresses with a 200 status. More on this in our guides to XML sitemap and robots.txt errors and hreflang errors.
  4. Check robots.txt. If you block the old URL, Googlebot can't see the redirect on it.
  5. For a domain change, submit the change of address in Google Search Console.

After launch (first 4 weeks)

  1. Monitor the "Page indexing" report in Search Console: a sudden rise in 404s and "Soft 404" points to gaps in your map.
  2. Track organic traffic and rankings of key pages weekly.
  3. Keep redirects for at least a year (Google's recommendation), ideally permanently for pages with many external links.

7. How to set up a redirect: Apache, Nginx, Next.js

The exact procedure depends on your platform. Here are the most common examples.

Apache (.htaccess)

# A single permanent redirect
Redirect 301 /old-url https://example.com/new-url
 
# A deliberately removed page (410)
Redirect gone /discontinued-product
 
# Everything to https and non-www, in ONE hop
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]

Nginx

# http -> https and www -> non-www, in one hop
server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://example.com$request_uri;
}
 
# In the main server block
location = /old-url { return 301 /new-url; }
location = /discontinued-product { return 410; }

Next.js (next.config.js)

module.exports = {
  async redirects() {
    return [
      // permanent: true => status 308; permanent: false => status 307
      { source: "/old-url", destination: "/new-url", permanent: true },
    ];
  },
};

WordPress, Shopify and similar systems

Most CMSs have a built-in redirect manager or a plugin. Choose one that lets you pick the redirect type (301/302) and export the list, so you can verify and maintain your redirects.

[!NOTE] The browser's developer tools sometimes show "307 Internal Redirect" for http → https. That is not a server error: it's the browser applying an HSTS rule itself. Check the real status with the curl tool or an online check.

8. How to check what your server actually sends

A quick check in the terminal

curl -sIL https://example.com/old-url

The -I flag shows only the headers and -L follows redirects. When everything is correct you'll see one 301 followed by 200 OK:

HTTP/2 301
location: https://example.com/new-url
 
HTTP/2 200
content-type: text/html; charset=utf-8

If you see two or more 301/302 lines before the 200, you have a chain that needs shortening.

A check that needs no terminal

For a whole website, manual checking isn't practical. Two free tools in the EFORTIS AI platform do what you'd otherwise do by hand:

  • Website Audit checks, when scanning a page, whether http redirects to https, how many hops a redirect takes to the final URL, and whether a non-existent address returns a proper 404 instead of a soft 404.
  • XML Sitemap Analyzer checks the live HTTP statuses of the URLs in your sitemap and lists those returning 3xx, 4xx or 5xx instead of 200.

Both checks cover the first and most important steps. For deeper analysis of the whole site, use the reports in Google Search Console.

What to look for in Google Search Console

In the Indexing → Pages report, the reasons for non-indexing matter:

MessageMeaningWhat to do
Page with redirectGoogle encountered a redirectNormal; make sure old addresses aren't in the sitemap
Not found (404)The URL returns 404If it's important, restore the content or add a 301
Soft 404The page looks empty or "doesn't exist" but returns 200Return a real 404 or add content
Redirect errorA loop or an overly long chainShorten to one hop
Server error (5xx)The server failedCheck hosting and logs

9. The most common mistakes that cause traffic loss

  1. Everything to the homepage. Mass-redirecting all old pages to the homepage is a frequent cause of "soft 404s" and lost rankings.
  2. 302 instead of 301 for a permanent move. The old address stays in results and the new URL doesn't inherit authority.
  3. Chains after multiple redesigns. Old redirects are never updated.
  4. Redirecting to a URL that is noindex or blocked in robots.txt. The destination can't be indexed, so the whole path is pointless.
  5. Old URLs left in the sitemap, canonical or hreflang. A sitemap may contain only clean addresses returning 200.
  6. A 404 page with a 200 code. The classic soft 404.
  7. Removing redirects too early. After a few months redirects are deleted while external links still point to the old addresses.
  8. A 503 that lasts for days. Short maintenance with a 503 is fine; multi-day unavailability reduces crawl frequency and can cause URLs to drop out.

10. Quick checklist before publishing changes

  • Every old URL has one destination URL (a redirect map).
  • Permanent changes use 301/308, temporary ones 302/307.
  • There are no chains (more than one hop) or loops.
  • Pages without a replacement return a real 404 or 410, not 200.
  • Canonical, hreflang and sitemap contain only final addresses with 200.
  • Internal links point to the new URLs, not to a redirect.
  • robots.txt doesn't block old URLs that carry redirects.
  • Monitoring is set up in Google Search Console (404s, soft 404s, redirects).
  • Redirects will be kept for at least a year.

Frequently Asked Questions (FAQ)

1. Is SEO value lost through a 301 redirect? Google states that signals pass through redirects, so a 301 isn't a "penalty". Real losses come from bad redirects: chains, redirecting to an irrelevant page, or deleting redirects too early.

2. How long should I keep a 301 redirect? At least a year. If the old address has many external links, keep the redirect permanently, since it costs nothing.

3. Is 404 or 410 better for a deleted page? The practical difference is small. 410 states more clearly that the removal is intentional and can speed up removal from the index. If you're unsure, 404 is perfectly acceptable.

4. Should redirects appear in the XML sitemap? No. A sitemap should contain only canonical URLs with a 200 status. Remove redirects, 404s and blocked addresses from it.

5. Can I take my site offline temporarily for maintenance without losing rankings? Yes, with 503 Service Unavailable and a Retry-After header. It tells search engines "come back later" without removing pages from the index. Avoid maintenance that lasts for days.

6. What if the redirect doesn't work or Google still shows the old address? Check the status with curl -sIL, make sure there's no chain and that the target returns 200, then request a re-inspection of the new URL in Search Console. Changes in the index can take from a few days to a few weeks.

Tomislav Šuk
Author & Founder
Tomislav Šuk

Founder of EFORTIS AI · SEO & AI Strategist

Over 10 years of hands-on experience in technical SEO, organic growth, and content automation across European markets. Through EFORTIS AI, he helps agencies, e-commerce brands, and businesses rank on Google and AI search engines without bloated tools.

Free Trial · 3 Days

Want to apply these SEO strategies in minutes?

Use EFORTIS AI for automated keyword research, natural multilingual article writing, and growth tracking across Google and AI search engines.

  • No credit card required to start
  • Full support for 10 languages and local NLP
  • Activation and first results in 60 seconds
Try for 3 days with no obligations or credit card required

Related Articles