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
| Status | Type | Method preserved? | SEO juice? | Use case |
|---|---|---|---|---|
| 301 | Permanent | Changes to GET | ✅ Transferred | URL migration, HTTP→HTTPS, www→non-www |
| 302 | Temporary | Changes to GET | ⚠️ Not transferred | A/B testing, geolocation, maintenance |
| 307 | Temporary | ✅ Preserved | ⚠️ Not transferred | POST redirects, API versioning |
| 308 | Permanent | ✅ Preserved | ✅ Transferred | Permanently moved POST/PUT endpoints |
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 CheckerRedirect 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/homein the database - Load balancer stripping the
X-Forwarded-Protoheader
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:
- Set up all 301s before updating sitemaps or canonical tags
- Update Google Search Console with the new URL
- Keep 301s active for at least 1 year
- Verify no 302s exist where you intended 301s