308 Permanent Redirect
Permanent redirect that preserves the request method.
The resource has permanently moved to another URL, and the request method should not change.
What HTTP 308 Permanent Redirect Means
The resource has permanently moved to another URL, and the request method should not change.
Permanent redirect that preserves the request method.
Common Causes
- Permanent URL change with method preservation
- HTTPS enforcement
What Visitors Should Do
- Update bookmarks
- Browser should cache redirect
Notes for Developers
- Use instead of 301 to preserve HTTP method
- Set Location header
308 vs 301 vs 307
| Code | Permanent? | Method on redirect | Typical use |
|---|---|---|---|
| 301 | Yes | May change POST to GET | Moved pages, domain or HTTPS migrations |
| 302 | No | May change POST to GET | Short-term moves, login redirects |
| 303 | No | Always GET | Redirect after a form POST |
| 307 | No | Must keep method and body | Temporary moves of APIs or forms |
| 308 | Yes | Must keep method and body | Permanent moves of APIs or forms |
RFC 9110 allows clients to switch a POST to GET on a 301 or 302 for historical reasons, which is why 307 and 308 exist.
How to Send a 308
# Nginx
location /api/v1/ { return 308 /api/v2/; }
Returning a 308 Permanent Redirect (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 308 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(308).json({ error: 'Permanent Redirect' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Permanent Redirect'), 308
PHP
<?php
http_response_code(308);
header('Content-Type: application/json');
echo json_encode(['error' => 'Permanent Redirect']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 308 Permanent Redirect
Frequently Asked Questions
What does HTTP 308 Permanent Redirect mean?
Permanent redirect that preserves the request method. In short: The resource has permanently moved to another URL, and the request method should not change.
How should I handle an HTTP 308 Permanent Redirect response?
Use instead of 301 to preserve HTTP method. Set Location header.
Official Specification
The 308 Permanent Redirect status code is defined in RFC 9110 Section 15.4.9 (originally RFC 7538).