Navigation
What does HTTP Status Code 308-Permanent Redirect mean?
308-Permanent Redirect status code is one of the classes of 3xx(redirection) response code that indicates the resources which were requested by the client to the server, have been definitively transferred to the URL(Uniform Resource Locator). The URI is given by the Location Headers field.
For automated redirection, the user agent MAY utilize the Location field value. A brief hypertext remark with a hyperlink to the updated URI is generally included in the server’s response payload.
According to the RFC7538 specification paper for the 308 status code, the 308 Permanent Redirect code was added to the HTTP standard very recently in April 2015. The RFC specification stated that the 308 Permanent Redirect code was required to fill the void left by comparable codes 301, 302, and 307.
This page is redirected by the browser, and search engines’ links to the resource are updated.
In HTTP Status Code 308, the target resource has been given a new permanent URI, and any future references to it should use one of the URIs provided.
Examples
HTTP/1.1 308 Permanent Redirect Location: https://bloggingbig.com/http/308-permanent-redirect Server: Apache/2.4.29 |
Implementations
cURL
If the answer includes a Location header, cURL correctly handles 308 redirects by following general 300 semantics. It lacks an explicit method for rewriting or updating URL references. In cURL 7.24.0, a test for this status code was added.
Nginx
When you apply a rewrite rule with the permanent flag, Nginx will deliver a 308 Permanent Redirect:
# Redirect www.bloggingbig.com to bloggingbig.com server { listen 80; server_name www.bloggingbig.com; location / { rewrite ^(/.*) https://bloggingbig.com$1 permanent; } } |
Location Header Field
In some responses, the Location header field is used to refer to a particular resource in connection to the response. The type of relationship is defined by the combination method of the request and status code semantics.
Location = URI-reference
It only provides a meaning when used with a 3xx (redirection) or 201 (created) status response.
Syntax
Location:<url> |
Example
Location:/index.html |
301- Moved Permanently Vs 308-Permanent Redirect
308 is somehow similar to 301.Both Status Code signals that the resource the user was attempting to access has relocated. The client should update any bookmarks from the old to the new URL in both situations. These statuses are also respected by search engines.
The distinction between 301 and 308 is that when a client sees a 308 redirect, they must make the identical request on the destination location. If the request was a POST with a body, the client must send a POST request to the new location with a body.
In the situation of 301, a customer has the option to do so. Most clients, in reality, do not do this and instead transform the POST request to a GET request.
The 308 is a very new protocol, and RFC7238 presently lists it as experimental. The majority of contemporary clients support it, while older clients may have difficulties.
Status
308 Permanent Redirect |
Specification
The Hypertext Transfer Protocol Status Code 308 (Permanent Redirect) (Permanent Redirect)# status.308 |
Browser compatibility
308 Code References
Symfony HTTP Status Constant | Response::HTTP_PERMANENTLY_REDIRECT |
Related Articles
HTTP Status Code 205 Reset Content |
HTTP Status Code 300-Multiple Choices |
HTTP Status Code 302 Found |
HTTP Status Code 204 – No Content |
HTTP Status Code 207 Multi-Status |
FAQ
What does HTTP Status Code 308 mean?
308-Permanent Redirect status code is one of the classes of 3xx(redirection) response code that indicates the resources which were requested by the client to the server, have been definitively transferred to the URL(Uniform Resource Locator).
What is the difference between Status Code 301 and 308?
The distinction between 301 and 308 is that when a client sees a 308 redirect, they must make the identical request on the destination location. If the request was a POST with a body, the client must send a POST request to the new location with a body.
In the situation of 301, a customer has the option to do so. Most clients, in reality, do not do this and instead transform the POST request to a GET request.
The 308 is a very new protocol, and RFC7238 presently lists it as experimental. The majority of contemporary clients support it, while older clients may have difficulties.
Conclusion
The new status code 308 specification recycles material from the HTTP/1.1 definitions of status codes 301 and 307.
I hope this article was able to help you with your doubts and queries related to the HTTP status code 308(Permanent Redirect). Still, if there are any queries related to this topic, feel free to ask in the comment section, we would be happy to assist you. Thank you.
Saurabh Chalise