This blog post will explain the HTTP 307 Temporary Redirect Status Code and when to use it. The HTTP 307 Temporary Redirect Status Code belongs to the 3xx status codes family. This means that the client must take additional action to complete the request. This group of status codes indicates that further action is a must. The redirect may happen without interacting with the client if the method in the second request is GET or HEAD.
In the following paragraphs, we will discuss the HTTP 307 status code in more detail. We will review the difference between it and the other 3xx status codes. Let’s get started!
What is HTTP 307 Temporary Redirect?
An HTTP status code is a message browsers receive from the server when the content is temporarily moved. For the content to be accessed, the browser must send another request to the new location where it was moved. The HTTP 307 status code implies a redirection and commands the browser to redirect to a new URL defined in the location header of the server’s response.
In other words, there is one initial request from the browser to the server and the response from the server. The 307 Temporary Redirect status code includes the new location in the response’s header. Then, there is a second request from the browser to the new location, and the server returns the new request. So, the 307 redirect allows the server to relocate the content without losing track of it. This allows the browser to find it.
Difference between 3xx and 307 Redirect
Among the different 3xx redirects, the most common are the 302 and 307 redirects. Both are used for temporary redirections, and the main difference is the way of handling the request method. The 302 redirect uses an entirely new request than an original, whereas a 307 uses the same original request using the POST request. The 302 redirect first uses POST and then switches to GET. So if you want to maintain the same request method, use the HTTP 307.
The HTTP 301 and 308 status codes are cached by default, unlike the HTTP 302 and 307. However, the HTTP 301 and 308 are Permanent redirects, while the HTTP 302 and 307 are Temporary redirects. The Cache-Control or Expires response header field can be added to make all HTTP redirects cacheable.
What is HTTP 307 Internal Redirect, and when should it be used?
The HTTP 307 Internal redirect is a variant of the 307 Temporary redirect. Since the internal redirect can be considered a temporary redirect, we can use it to move the webpage temporarily to a new URL, with a plan to move it back to the original URL. This is used when there is maintenance on the website, such as some upgrades, website migration, etc. The good thing is that the search engines will not update the resource’s new location if we use an HTTP 307 redirect. Internal 307 redirects can be set in the .htaccess file in the document root of the website using the following line of code:
RewriteEngine On RewriteRule ^domain-name-page\.html$ /domain-name-new-page.html [R=307,L]
How does HTTP 307 affect SEO?
We explained almost everything in the previous paragraphs. Since the HTTP 307 Internal Redirect happens locally on the browser level, there is no direct effect on the SEO of the website. This is because the search engines do not update the records in the database for the new URL. The link juice from the original URL is not passed to the new URL. Link juice is a term used in search engine optimization (SEO) to describe the value one page or website can pass to another page or website through a link.
Conclusion
The HTTP 307 Temporary Redirect Status Code redirects the website temporarily without affecting the SEO. This redirect is used when there is temporary site maintenance or downtime, when handling resource location changes, when submitting forms, when authentication and authorization are required, etc. However, we should pay attention to inadvertently redirecting users to an infinite redirection loop, causing too many redirect errors.
That’s it. You learned the HTTP 307 Temporary Redirect Status Code and when to use it.
If you have difficulties with this, our Linux admins will help you. You must sign up for one of our monthly server management or per-incident server support plans. Do not hesitate to contact us anytime. We are available 24/7.
PS. If you liked this post about the HTTP 307 Temporary Redirect Status Code, please share it with your friends on social networks or leave a comment in the comments section. Thank you.