SiteError.comYour friendly guide to HTTP status codes
Status CodesBlog
  1. Home
  2. Blog
  3. Understanding HTTP 301 Redirects: SEO, Migrations, and Common Pitfalls

Understanding HTTP 301 Redirects: SEO, Migrations, and Common Pitfalls

April 15, 20267 min read
3xxRedirection

The 301 Moved Permanently redirect is one of the most powerful — and most misused — tools in web development. Get it right, and your site migration is seamless. Get it wrong, and you could lose years of search engine rankings overnight. Let's break down what 301 actually means, when to use it, and how to avoid the common traps.

What Is a 301 Redirect?

A 301 status code tells the client that the requested resource has permanently moved to a new URL. The browser should update its bookmarks and follow the new Location header automatically.

The 301 (Moved Permanently) status code indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. — RFC 9110, Section 15.4.2

The key word is permanent. You're telling browsers and search engines: "This move is final. Update your records."

When to Use a 301

301 redirects are the right choice when a URL is changing for good:

  • Domain migrations — Moving from old-domain.com to new-domain.com
  • HTTP to HTTPS — Enforcing secure connections across your entire site
  • URL restructuring — Changing /blog/2024/post-title to /articles/post-title
  • Trailing slash normalization — Picking one canonical form (/about vs /about/) and redirecting the other
  • Vanity URLs — Redirecting /sale to /promotions/summer-2026
  • Domain consolidation — Merging www.example.com and example.com to a single canonical domain

The SEO Implications

This is where 301s really matter. When a search engine encounters a 301, it does two critical things:

  1. Transfers link equity — The ranking power ("link juice") from the old URL is passed to the new one. Without a 301, those inbound links pointing to the old URL would effectively be lost.
  2. Updates the index — The search engine replaces the old URL in its index with the new one and re-attributes all ranking signals.

This is why a 301 is essential during a site migration. A 302 (temporary redirect) tells search engines to keep the old URL in their index, which means you won't transfer link equity and could end up with both URLs competing against each other.

301 vs. Other Redirect Codes

Choosing the wrong redirect code is one of the most common mistakes. Here's a quick comparison:

StatusNamePermanent?Preserves HTTP Method?Use When
301Moved PermanentlyYesNo (may change to GET)URL changed forever, SEO migration
302FoundNoNo (may change to GET)Temporary redirect (A/B test, maintenance)
307Temporary RedirectNoYesTemporary redirect for POST/PUT requests
308Permanent RedirectYesYesPermanent redirect for POST/PUT requests

The critical distinction between 301 and 308: a 301 allows the browser to change the HTTP method from POST to GET, while a 308 guarantees the method stays the same. For typical page-to-page redirects, this doesn't matter. For API endpoints that accept POST requests, use 308 if you need to preserve the method.

Implementation Examples

NGINX

# Single redirect
server {
    listen 80;
    server_name old-domain.com;
    return 301 https://new-domain.com$request_uri;
}
 
# Redirect specific path
location /old-page {
    return 301 /new-page;
}
 
# HTTP to HTTPS
server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

Apache (.htaccess)

# Single page redirect
Redirect 301 /old-page https://example.com/new-page
 
# Entire domain redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain\.com [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]

Next.js (next.config.js)

module.exports = {
  async redirects() {
    return [
      {
        source: "/old-blog/:slug",
        destination: "/articles/:slug",
        permanent: true, // 301
      },
      {
        source: "/about-us",
        destination: "/about",
        permanent: true,
      },
    ];
  },
};

Node.js / Express

// Single redirect
app.get("/old-page", (req, res) => {
  res.redirect(301, "/new-page");
});
 
// Redirect all HTTP to HTTPS (middleware)
app.use((req, res, next) => {
  if (req.headers["x-forwarded-proto"] !== "https") {
    return res.redirect(301, `https://${req.hostname}${req.url}`);
  }
  next();
});

Redirect Chains and Loops

A redirect chain happens when one redirect leads to another, which leads to another:

/page-v1 → 301 → /page-v2 → 301 → /page-v3 → 301 → /page-final

Each hop adds latency, and search engines may stop following after a few hops — meaning your final page might never get indexed. Google has stated they'll follow up to 10 redirects, but each one dilutes crawl efficiency.

A redirect loop is worse — it's a chain that circles back on itself:

/page-a → 301 → /page-b → 301 → /page-a → (infinite loop)

Browsers will detect this and show an error, and search engines will give up entirely.

How to Detect Them

# Follow the redirect chain with curl
curl -v -L https://example.com/old-page 2>&1 | grep -i "location:"
 
# See the full chain with status codes
curl -sIL https://example.com/old-page | grep -E "HTTP/|Location:"

Chrome DevTools is also helpful — open the Network tab, navigate to the URL, and look for the chain of 3xx responses.

The Caching Trap

Browsers cache 301 redirects aggressively. Once a browser sees a 301 from /old to /new, it will skip the server entirely on future visits and go straight to /new. This is by design — "permanent" means permanent.

The problem: if you set up a 301 incorrectly, fixing it on the server won't help users who already cached the bad redirect. They'll keep getting sent to the wrong place until they clear their browser cache.

How to protect yourself:

  • Test redirects in an incognito/private window before deploying
  • Use a 302 first to verify the destination is correct, then switch to 301
  • Set a reasonable Cache-Control on your 301 responses so browsers will eventually recheck:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Cache-Control: max-age=86400

A 24-hour cache (86400 seconds) gives you the SEO benefits of a 301 while keeping a recovery window if you make a mistake.

Common Mistakes

  1. Redirecting everything to the homepage — When restructuring a site, lazy redirects send all old URLs to /. Search engines see this as a soft 404 and you lose the ranking power of every individual page.

  2. Creating redirect chains — When you move a page twice, update the original redirect to point directly to the final destination. Don't leave a chain of hops.

  3. Dropping query parameters — If your old URL had ?utm_source=newsletter, make sure the redirect carries that through. Lost tracking parameters mean lost attribution data.

  4. Forgetting internal links — After setting up redirects, update all internal links to point to the new URLs directly. Redirects should be a safety net for external links you can't control, not a substitute for fixing your own links.

  5. Using 301 when you mean 302 — If the redirect is temporary (A/B test, maintenance page, seasonal promotion), use a 302. A 301 tells search engines the old URL is gone forever.

Wrapping Up

301 redirects are simple in concept but consequential in practice. They're essential for preserving SEO equity during migrations, enforcing HTTPS, and maintaining a clean URL structure. But they demand precision — a wrong redirect can be cached for days, chains can tank your crawl efficiency, and choosing 301 when you meant 302 can confuse search engines.

Test in incognito, keep chains short (ideally zero hops), and always update your internal links after a migration. The redirect is a safety net, not a permanent solution.

For more details on redirect codes, check out our pages on 301 Moved Permanently, 302 Found, 307 Temporary Redirect, and 308 Permanent Redirect. You can also compare 301 vs 302 side by side.

Related Status Codes

🚪300Multiple Choices📦301Moved Permanently🔀302Found👀303See Other💾304Not Modified🕵️305Use Proxy↪️307Temporary Redirect🏠308Permanent Redirect
Back to Blog

Popular Status Codes

  • 200 OK
  • 301 Moved Permanently
  • 302 Found
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 500 Internal Server Error
  • 502 Bad Gateway
  • 503 Service Unavailable

Compare Codes

  • 401 vs 403
  • 301 vs 302
  • 404 vs 410
  • 500 vs 502
  • Compare any codes →

Categories

  • Informational
  • Success
  • Redirection
  • Client Error
  • Server Error
  • NGINX
  • Cloudflare
  • AWS ELB
  • Microsoft IIS

Tools

  • Cheat Sheet
  • Status Code Quiz
  • URL Checker
  • API Playground
  • Blog

© 2026 SiteError.com. All rights reserved.