Headers

301 vs 308 Redirect — Which Should You Use for SEO and APIs

Updated April 2026

Reading this? Verify your fix live. Audit your redirect headers → EdgeFix

Both 301 and 308 are permanent redirects. The difference is one detail: 301 changes POST to GET on redirect. 308 preserves the original HTTP method. For browser page redirects this does not matter — for APIs it does.

The difference visualised

# 301 Moved Permanently
POST /old-endpoint → 301 → GET /new-endpoint  ← method changed!

# 308 Permanent Redirect
POST /old-endpoint → 308 → POST /new-endpoint  ← method preserved ✅

When to use each

SituationUseWhy
www to non-www301Browser navigation — method change irrelevant
HTTP to HTTPS301Browser navigation — use HSTS instead for repeat visits
Old page URL to new URL301Standard permanent page move
Old API endpoint to new308API clients use POST/PUT — preserve the method
Domain migration301Standard — browsers follow automatically

Config by stack

Nginx — 301 (page redirect)

server { listen 80; server_name yourapp.com; return 301 https://yourapp.com$request_uri;  # HTTP → HTTPS
}

server { server_name www.yourapp.com; return 301 https://yourapp.com$request_uri;  # www → non-www
}

Nginx — 308 (API endpoint move)

location /api/v1/submit { return 308 /api/v2/submit;  # preserves POST method
}

Vercel (vercel.json)

{ "redirects": [ { "source": "/old-page", "destination": "/new-page", "permanent": true  // uses 308 in Vercel }, { "source": "/api/v1/:path*", "destination": "/api/v2/:path*", "permanent": true } ]
}

Cloudflare Redirect Rules

# Rules → Redirect Rules → Create Rule
# Choose: 301 Moved Permanently or 308 Permanent Redirect
# Source: /old-path
# Target: /new-path

The full redirect status code map

CodePermanent?Preserves method?Use for
301✅ Yes❌ No (POST → GET)Page moves, domain changes
302❌ No❌ No (POST → GET)Temporary redirects (login, auth)
307❌ No✅ YesTemporary API endpoint changes
308✅ Yes✅ YesPermanent API endpoint moves
Audit your redirect headers → EdgeFix
Check if your domain is on the HSTS preload list → HSTS Preload Checker