HTTPQUERY
English

308 Permanent Redirect

Usage

When the 308 Permanent Redirect status code is received, clients are expected to update stored links to the new URI. The new URI is specified by the Location header and is used by the client for automatic redirection.

This response is common when servers migrate to a new domain or reorganize their internal file structure with no plan to revert to the former URI.

The 308 Permanent Redirect status code differs from the 301 in one critical way: the client is required to preserve the original request method. A 301 response allows the client to change a POST request to a GET request on the redirect. A 308 Permanent Redirect requires the follow-up request to use the same method as the original. This makes 308 the correct choice when method preservation matters, such as API endpoints and form submissions. The 308 status code was originally defined as a separate specification before being incorporated into the core HTTP standard.

Example

The client submits a POST request to an API endpoint. The server responds with 308 Permanent Redirect to indicate the endpoint has moved. The client is required to repeat the POST request, including the original body, at the new Location.

Request

POST /api/v1/orders HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 35

{"item": "widget", "quantity": 10}

Response

HTTP/1.1 308 Permanent Redirect
Location: http://example.com/api/v2/orders
Content-Type: text/html; charset=UTF-8
Content-Length: 118

<h1>API endpoint moved</h1>
<body>
The orders endpoint has moved to
<a href=/api/v2/orders>/api/v2/orders</a>.
</body>

Code references

.NET

HttpStatusCode.PermanentRedirect

Rust

http::StatusCode::PERMANENT_REDIRECT

Rails

:permanent_redirect

Go

http.StatusPermanentRedirect

Symfony

Response::HTTP_PERMANENTLY_REDIRECT

Python3.5+

http.HTTPStatus.PERMANENT_REDIRECT

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_PERMANENT_REDIRECT

Angular

@angular/common/http/HttpStatusCode.PermanentRedirect