Navigation
What does HTTP Status Code 307-Temporary Redirect mean?
HTTP Status Code 307-Temporary Redirect is one of the classes of 3xx(redirection) response code that indicates the target resource is temporarily located at a different URIs given by the Location headers, and if the user agent conducts an automated redirection to that URIs, the user agent MUST NOT alter the request method. As the redirection may change in the coming future, the client should continue to use the original effective request URI for subsequent requests. 302s were widely used to establish temporary redirection prior to the release of HTTP 1.1. However, as a legitimate temporary redirect, they were replaced with 307s. The original request’s method and body are utilized to complete the redirected request. Use 303 See Other instead of POST in instances where you wish the method to be changed to GET. This is helpful when you wish to respond to a PUT method with a confirmation message rather than the uploaded resources. The server SHOULD provide a URI reference for the changed URI in the Location header field of the response. For automated redirection, the user agent MAY utilize the Location field value. A brief hypertext remark with a hyperlink to the changed URI is generally included in the server’s response payload. |
Do 307 Redirects Affect SEO?
HTTP Status Code 307 Redirects don’t have any significant influence on our site’s SEO. The link juice is not transferred from the old URL to the new URL when you use a 307 Temporary Redirect.
Everything happens at the browser level with a 307 Internal Redirect, therefore it shouldn’t have a big influence on your site’s SEO.
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 |
Using 302 vs 303 vs 307 for Temporary Redirects
The majority of clients interpret a 302 status code as a 303 answer and switch to the GET HTTP request method. From a security viewpoint, this isn’t ideal. Use the stricter HTTP 307 Temporary Redirect response for temporary redirection when the HTTP request method must be maintained. Redirecting /register-form.html to /signup-form.html or /login.php to /signin.php, for example. Use the 303 See Other answer instead if you need to modify the redirect request method to GET. For example, using a GET request to redirect a POST request from the /register.php page to the /success.html page. Avoid utilizing the 302 Found redirect response unless your intended audience uses legacy clients. |
Status
307 Temporary Redirect |
Specification
Browser compatibility
307 Code References
Rails HTTP Status Symbol | :temporary_redirect |
Go HTTP Status Constant | http.StatusTemporaryRedirect |
Symfony HTTP Status Constant | Response::HTTP_TEMPORARY_REDIRECT |
Python2 HTTP Status Constant | httplib.TEMPORARY_REDIRECT |
Python3+ HTTP Status Constant | http.client.TEMPORARY_REDIRECT |
Python3.5+ HTTP Status Constant | http.HTTPStatus.TEMPORARY_REDIRECT |
Related Articles
FAQs
What does HTTP Status Code 307 mean?
307-T temporary Redirect status code is one of the classes of 3xx(redirection) response code that indicates the target resource is temporarily located at a different URIs given by the Location headers.
What is the difference between Status Code 302 and 307?
The sole difference between 307 and 302 is that 307 ensures that the method and content of the redirected request will not be altered. Some older clients mistakenly changed the method to GET with 302, resulting in unexpected behavior on the Web with non-GET methods with 302, whereas the behavior with 307 is predictable. Their behavior is similar for GET requests.
Conclusion
As described in the RFC2616 specification document that sets the requirements for that version of HTTP, the 307 Temporary Redirect code was added to the HTTP standard in HTTP 1.1.
I hope this article was able to help you with your doubts and queries related to the HTTP status code 307(Temporary 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