The HTTP 307 status code, or Temporary Redirect
, is used when you want to temporarily move resources located at one URL to another URL. It's important to note that the main difference between this code and 302 is that 307 instructs browsers to keep the original request method; for instance, if a request is POST
, after the redirect, it must remain POST
.
When you need to temporarily move a website to a different domain or another address for a specific time, without losing the old addresses from search engines, you can use this code. In this case, this code informs users with this message that this change is not permanent.
For developers and individuals working with API design, understanding this code is very important. For example, in situations where you need to send a specific HTTP response for certain users or under specific conditions, send a specific HTTP response.
Proper use of this status code can create a significant differentiation in the redirect patterns you implement and provide you with solutions with better performance. Below is an example code and its explanation:
HTTP/1.1 307 Temporary Redirect
Location: https://example.org/newpage
Line-by-Line Explanation of the Code
HTTP/1.1 307 Temporary Redirect
This line indicates that the HTTP status code being reported is a temporary redirect, and users are expected to return to the original state afterward.
Location: https://example.org/newpage
This line indicates the new address where users should go to access the requested resources.