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