308 Permanent Redirect
Example HTTP Response
HTTP/1.1 308 Permanent Redirect
Location: /new-permanent-endpoint- API endpoint permanently moved
- Maintaining POST method during redirect
- Permanent URL restructuring
What does this mean?
Permanent new address, same attitude! The resource moved forever but you can keep doing your thing the same way.
Technical Definition
The resource has permanently moved to another URI, specified in the Location header. Method and body unchanged.
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(308).json({
error: 'Permanent Redirect',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(308, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'Permanent Redirect',
message: 'Your error message here'
}));
}).listen(3000);- 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
- Clients should update their references to use the new URL
Indexing
Like 301, the old URL is de-indexed and replaced by the new URL. Google passes ranking signals to the destination.
Crawler Behavior
Crawlers follow the redirect and eventually stop crawling the old URL. Behavior is identical to 301 for SEO.
Canonical URL Notes
308 is a strong canonical signal, identical to 301. The destination URL becomes canonical in Google's index.
Google Notes
Google treats 308 the same as 301 for indexing. The method preservation feature is irrelevant since crawlers use GET.
308 Permanent Redirect FAQ
What causes a 308 Permanent Redirect error?
API endpoint permanently moved. Maintaining POST method during redirect. Permanent URL restructuring.
When should I use 308 Permanent Redirect?
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. Clients should update their references to use the new URL.