The 307 Temporary Redirect is an HTTP status code that indicates
a temporary redirection of a URL. It is similar to the more
commonly known 302 Found redirect, but with one key difference -
it instructs the client (e.g., web browser) to use the same
request method for the redirected URL as was used for the
original request.
Here are some key points about 307 Temporary Redirect status
code:
- Purpose: The main purpose of using a 307
redirect is to temporarily direct users and search engines
from one URL to another without changing their original
request method (GET, POST, etc.). This can be useful in
scenarios where a resource or webpage has been moved
temporarily and will soon return back to its original
location.
- Temporary redirect: The main characteristic
of this response is that it signifies temporary relocation
rather than permanent movement of resources. The original URL
may still be valid in the future, so clients should continue
using it for subsequent requests.
- SEO implications: Search engine crawlers
treat temporary redirects differently than permanent ones (301
and 308 redirect). With a 307 redirect, search engines
continue indexing both URLs separately instead of
consolidating them into one indexed page. Be aware also that
if there are more than 5 hops (each redirect in the chain is
referred to as a “hop.”) in a chain, Googlebot will not land
on the destination URL.
- User experience: Users may not notice any
significant difference if their web browser handles redirects
seamlessly. However, repeated use of temporary redirects can
lead to slower browsing experiences due to additional round
trips between server and client.
- Caching behavior: According to HTTP
specifications, a 307 Temporary Redirect response should not
be cached by the client. The purpose of this status code is to
indicate that the requested resource is temporarily available
at a different URL, and the client should make future requests
to that new URL instead. Clients are generally expected to
treat 307 responses as temporary and not cache them.
- Latency: The client/browser must continue to
send the request to the original URL. 307 redirects therefore
have higher latency because they still have to send the
request to the original URL and then redirect to the new
location each time.
- Similar status codes:
- 301 Moved Permanently: This status code
implies a permanent redirect, where the original URL is no
longer valid, and clients should use the new URL for all
future requests.
- 302 Found: Similar to 307 Temporary
Redirect but does not instruct clients to preserve the
original request method (GET/POST) when following the
redirection.
- 308 Permanent Redirect: Similar to 301
Move Permanently but explicitly instructs clients to
preserve the original request method (GET/POST) when
following the redirection.
- Best practices:
- Use appropriate caching directives with caution.
-
Avoid excessive usage of temporary redirects if possible.
-
Ensure proper handling and testing across various browsers
and devices.
-
Specify accurate "Location" header values pointing to
valid URLs.
In summary, the 307 Temporary Redirect status code informs
clients that they should temporarily access the requested
resource from another location while keeping in mind that this
redirection might change in the future.