301 vs 308
Moved Permanently vs Permanent Redirect
301Moved Permanently
We've moved! Like forwarding your mail after moving to a new house. Update your bookmarks!
HTTP/1.1 301 Moved Permanently
Location: https://new-site.com/page308Permanent Redirect
Permanent new address, same attitude! The resource moved forever but you can keep doing your thing the same way.
HTTP/1.1 308 Permanent Redirect
Location: /new-permanent-endpointRedirect Codes: Permanent vs Temporary
Permanent Redirects
Old-Style Permanent
Classic redirect
Resource has permanently moved. Browsers and search engines will update their bookmarks and indexes.
- POST /old-url
- Server responds with new location301 β /new-url
β οΈ May change to GET
- Browser caches the redirect
- SEO: Link juice transferred
- β οΈ May change POST to GET
Modern Permanent
Method-preserving
Like 301, but guarantees the HTTP method and body won't change during redirect.
- POST /old-url
- Server responds with new location308 β /new-url
β Keeps POST method
- Browser caches the redirect
- SEO: Link juice transferred
- β Preserves HTTP method
Temporary Redirects
Old-Style Temporary
Classic temporary
Resource is temporarily at another location. Original URL should still be used in the future.
- POST /temp-moved
- Server responds with temp location302 β /temp-url
β οΈ May change to GET
- No browser caching
- SEO: Original URL preserved
- β οΈ May change POST to GET
Modern Temporary
Method-preserving
Like 302, but guarantees the HTTP method and body won't change during redirect.
- POST /temp-moved
- Server responds with temp location307 β /temp-url
β Keeps POST method
- No browser caching
- SEO: Original URL preserved
- β Preserves HTTP method
Quick Decision Guide
- URL has changed forever
- You want search engines to update their index
- Domain migration or restructuring
- Old URL should never be used again
- Resource is temporarily unavailable
- A/B testing or maintenance mode
- You want to keep the original URL active
- Redirect might change or be removed soon
- Redirecting POST/PUT/DELETE requests
- Request body must be preserved
- Working with REST APIs
- Modern application with strict HTTP semantics
Key Insight
Permanent vs Temporary controls caching and SEO, while Old vs Modern controls HTTP method preservation. For APIs and POST requests, prefer 307/308. For simple page redirects, 301/302 are widely supported and sufficient.
The URL of the requested resource has been changed permanently. The new URL is given in the response.
- The resource URL has changed permanently and will never return
- You want search engines to update their index to the new URL
- Consolidating multiple URLs to a canonical URL for SEO
- Website restructured with new URLs
- Domain name changed
- Page permanently relocated
The resource has permanently moved to another URI, specified in the Location header. Method and body unchanged.
- Permanent redirect that must preserve the HTTP method (POST stays POST)
- API endpoints that have moved permanently
- Preferred over 301 when method preservation is critical
- API endpoint permanently moved
- Maintaining POST method during redirect
- Permanent URL restructuring
Decision Tree
Is this redirect permanent?
Must the HTTP method be preserved (e.g., POST stays POST)?
Use 308 Permanent Redirect
Status Code: 308
Use 301 Moved Permanently
Status Code: 301
Use 302 or 307 (see 302-307 decision tree)
Status Code: 302