Redirects — 301, 302 and Redirect Chains

Guide to HTTP redirects — difference between 301/302/307/308, how chains affect SEO and speed, and how to detect redirect loops.

What Are HTTP Redirects?

An HTTP redirect is a response telling the browser that the page it requested is elsewhere. The server returns a 3xx status code along with a Location header pointing to the new address.

Redirects are everywhere: HTTPS enforcement, www/non-www consolidation, old URLs after a redesign, trailing slash normalization. Misconfigured redirects cost you SEO, speed and security.

Types of Redirects

StatusTypeMethod preserved?SEO juice?Use case
301PermanentChanges to GET✅ TransferredURL migration, HTTP→HTTPS, www→non-www
302TemporaryChanges to GET⚠️ Not transferredA/B testing, geolocation, maintenance
307Temporary✅ Preserved⚠️ Not transferredPOST redirects, API versioning
308Permanent✅ Preserved✅ TransferredPermanently moved POST/PUT endpoints
💡 301 vs 302: Use 301 for permanent changes — Google will transfer PageRank. With 302, Google assumes the original URL will return, so it doesn't pass authority.

Redirect Chains

A redirect chain occurs when URL A → URL B → URL C. Each hop:

  • Adds latency (DNS lookup + TCP handshake + TTFB per hop)
  • Can lose PageRank (especially if a 302 is in the chain)
  • Makes crawling harder (Googlebot follows chains but treats long chains as suspicious)

Best practice: Maximum 1-2 hops. If you have A→B→C, create a direct A→C redirect instead.

See your URL's full redirect chain with status codes and per-hop latency:

→ Redirect Checker

Redirect Loops

A redirect loop occurs when A→B→A (or A→B→C→A). The browser shows «ERR_TOO_MANY_REDIRECTS» and the user sees nothing.

Common Causes

  • HTTPS redirect configured at both server and application level simultaneously
  • Cloudflare SSL mode «Flexible» + HTTPS redirect on the origin server
  • WordPress with wrong siteurl/home in the database
  • Load balancer stripping the X-Forwarded-Proto header

Common Redirect Scenarios

HTTP → HTTPS (Apache)

<VirtualHost *:80>
  ServerName example.com
  Redirect permanent / https://example.com/
</VirtualHost>

HTTP → HTTPS (Nginx)

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

www → non-www (Nginx)

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

Trailing Slash Normalization

# Apache — remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]

Redirects and SEO

301/308 redirects pass PageRank (link equity) to the new URL. However, Google suggests there may be a small loss (~10-15% per hop). For migrations:

  1. Set up all 301s before updating sitemaps or canonical tags
  2. Update Google Search Console with the new URL
  3. Keep 301s active for at least 1 year
  4. Verify no 302s exist where you intended 301s

Frequently Asked Questions

When should I use 301 vs 302?
301 for permanent changes (HTTP→HTTPS, www consolidation, URL restructuring). 302 for temporary ones (maintenance, A/B test, country-specific page). When in doubt, 301 is almost always the right choice.
Do redirects affect page speed?
Each hop adds 50-200ms latency (DNS + TCP + TTFB). For mobile users on slow connections, a chain of 3+ hops can add 500ms+ to page load time. Fewer hops = better Core Web Vitals score.
What causes ERR_TOO_MANY_REDIRECTS?
The browser detected a redirect loop. Most common cause: Cloudflare SSL mode «Flexible» with HTTPS redirect on the origin server. Fix: change Cloudflare SSL mode to «Full» or «Full (Strict)».
Are backlinks preserved after a 301 redirect?
Yes — Google passes link equity from backlinks pointing at the old URL to the new one via 301. You don't need to ask sites to update their links, although it's good practice for direct attribution.

Try it now

Related guides