3xx RedirectionRFC 7538
308Permanent Redirect
Permanent redirect — method and body must not change.
What it means
Like 301 but guarantees the HTTP method will not change. A POST to the old URL will POST to the new URL permanently. Use instead of 301 when you need to permanently redirect POST requests.
When to use it
- ✓Permanently redirecting API endpoints that receive POST/PUT requests
- ✓Form submission endpoints that have permanently moved
Code Examples
Express — permanent POST redirect
javascript
app.post('/api/v1/orders', (req, res) => {
res.redirect(308, '/api/v2/orders');
});Quick Facts
Code308
CategoryRedirection
SpecRFC 7538
CommonNo
Relevant Headers
Location
The permanent new URL