Synonyms: Method-preserving redirect
A 307 redirect is an HTTP status code used to indicate a temporary redirection of a URL. When a browser or search engine encounters a 307 redirect, it understands that the resource has been temporarily moved to a different URL, but the original URL will still be used again in the future. Unlike permanent redirects, a 307 redirect ensures that the HTTP method (such as GET or POST) used by the client does not change during the redirection.
This type of redirect is commonly used when a website needs to temporarily move a page or resource without losing the ability to return to the original URL.
How a 307 Redirect Works
When a web server returns a 307 redirect, it tells the browser to temporarily visit another URL while keeping the request method intact. For example, if the user submitted a form via a POST request, the browser would use the same POST method when following the redirected URL. This consistency is the key difference between a 307 redirect and other types of redirects like a 301 (permanent redirect), which allows the request method to change.
Key Points to Understand:
- Temporary Nature: A 307 redirect signals that the change is temporary. The original URL is expected to be used again, so search engines do not transfer SEO value (link equity) from the original page to the temporary one.
- Method Preservation: Unlike 302 redirects (another type of temporary redirect), a 307 ensures that the request method doesn’t change. If a user accesses the original page with a POST request, the browser will send the same type of request to the new URL.
- Search Engine Behavior: Since a 307 redirect is temporary, search engines generally do not replace the original URL in their index with the new one. This means that any SEO value associated with the original URL is not transferred to the temporary page.
When to Use a 307 Redirect
A 307 redirect should be used in situations where a page or resource needs to be temporarily moved, but it is critical that the original URL remains in use in the future. For example:
- Temporary Maintenance: If a webpage is temporarily down for maintenance and you want to redirect users to a different page while maintaining the original URL’s long-term value, a 307 redirect is appropriate.
- A/B Testing: If you’re running A/B tests and want to temporarily direct traffic to a different version of a page without altering the original page’s SEO, a 307 redirect can be useful.
307 Redirect vs. Other Redirects
- 307 vs. 301: A 301 redirect is used for permanent changes. It passes link equity to the new URL and tells search engines to update their index. A 307, by contrast, does not pass SEO value and is only for temporary changes.
- 307 vs. 302: Both 307 and 302 redirects are temporary, but a 307 ensures that the request method stays the same. In a 302 redirect, the method can change (e.g., a POST request might be turned into a GET request).
Technical Considerations
Implementing a 307 redirect is done through server-side configuration. For example, in an Apache server, a temporary redirect using the 307 status code might look like this:
Redirect 307 /old-page.html http://example.com/new-page.html
This ensures that any requests for the old URL will be temporarily redirected to the new URL, while maintaining the original HTTP method.