308 Permanent Redirect
Fault: Neither
TL;DR
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
How to Fix It (For Visitors)
- Update bookmarks
- Browser should cache redirect
How to Fix It (For Developers/Admins)
- Use instead of 301 to preserve HTTP method
- Set Location header
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 7538.