308 Permanent Redirect

308
Permanent Redirect

Example HTTP Response

HTTP Response
HTTP/1.1 308 Permanent Redirect
Location: /new-permanent-endpoint
Common Causes
  • API endpoint permanently moved
  • Maintaining POST method during redirect
  • Permanent URL restructuring
Technical Details

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.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// 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);
When to Use This Code
  • 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
SEO Handling

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.

Commonly Confused With

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.