Redirects are an essential element of site management and SEO, as they allow for a smooth user experience and maintain search ranking. The 307 redirect is one of the less popular but essential HTTP status codes for redirects. When it comes down to it, what is HTTP 307 redirect code, and how do we use it? In this article, we cover any questions you might have about HTTP 307 status codes, the significance of 307 redirects, and how they differ from the 301, 302, or other redirects. By the end of this blog post, we hope you will have a greater understanding of how temporary redirects individually impact SEO and server functionality and how to create a method on your site for 307 redirects.
What Is a 307 Redirect?
A 307 redirect is an HTTP status code relating to a temporary redirect. When a user requests a particular URL, the server returns a 307 Temporary Redirect status code to the requesting browser and instructs the user to navigate to a different URL, all while maintaining the original HTTP method (GET or POST). In short, a 307 redirect indicates the change is temporary, while a 301 redirect is permanent.
307 Redirect Key Features:
1. Temporary: A 307 is different from a 301 redirect because the 307 redirect says it is a temporary (not permanent) move.
2. Maintains HTTP methods used: The request method (i.e., GET versus POST) is still used.
3. Can be used a lot on server-side: A 307 Redirect is often used on server-side redirects – for example, if a server is down for maintenance or when content is simply in a new temporary location.
4. SEO aspects: When a redirect is a 307, the search engine is aware that the move is temporary, and as such, the search engine does not pass any link equity (SEO juice) to the new URL.
307 Redirects vs Other Redirects
It is essential to know the differences between 307 Redirects and common redirects like 301 or 302 redirects.
307 Redirect vs. 301 Redirect
Feature | 307 Redirect | 301 Redirect |
Nature | Temporary | Permanent |
Link Equity | Not Passed | Passed |
HTTP Methods | Preserved | May Change |
SEO Impact | No ranking benefits | Helps in SEO ranking |
Use Case | Temporary page movement | Permanent URL changes |
A 301 redirect is the best choice for permanent changes, while a 307 redirect should be used when you want the original URL to be accessible again in the future.
307 Redirect vs. 302 Redirect
Feature | 307 Redirect | 302 Redirect |
Nature | Temporary | Temporary |
Link Equity | Not Passed | Not Passed |
HTTP Methods | Preserved | Might change |
SEO Impact | Minimal impact | Minimal impact |
While both 302 and 307 redirects indicate a temporary change, the 307 status code ensures that the request method remains unchanged.
When Should You Use a 307 Redirect?
Transform Your Digital Presence
Get personalized strategies and solutions tailored to your business needs.
- Free Initial Consultation
- Custom Solution Planning
- Expert Team Support
Now that we understand what a 307 redirect is, we can look at some cases where it could be beneficial:
1. Site Maintenance – If your site is undergoing maintenance, a 307 redirect can redirect users to other pages to cover the time your website is down and maintain your SEO rankings.
2. A/B Testing – If you are doing A/B testing of two variants of a webpage, you could set a page to redirect to a temporary page using a 307 redirect. This could be helpful in temporarily redirecting users to a page while traffic is being rotated to each of the variants during A/B testing.
3. Mobile-specific URLs – Many websites commonly implement a 307 redirect to redirect mobile view users to a page that the mobile view was intended for, redirect mobile view users, or desktop view users.
4. Login & Authentication Pages – Some login processes are based on using a 307 redirect so that they are secure, as well as to ensure that the HTTP methods are preserved.
How to Create a 307 Redirect
There are several options for creating a 307 redirect, depending on the server type. Below are the methods for Apache, Nginx, and JavaScript.
1. Through .htaccess (Apache Server)
If you are using an Apache server to serve your website, you can create a 307 redirect using the .htaccess file. Redirect 307 /old-page.html https://www.example.com/new-page.html
2. Through Nginx Config
For an Nginx server, enter the following directive in the configuration file:
server { location /old-page { return 307 https://www.example.com/new-page; }}
3. Through JavaScript
In the case of client-side redirection, you can always use JavaScript as follows: window.location.replace(“https://www.example.com/new-page”); This is generally not considered to be an SEO-friendly approach since it may not always be considered a redirect by a search engine.
4. Through PHP
If you are using PHP on your website, you can create a 307 redirect using the following code: header(“Location: https://www.example.com/new-page,” true, 307); exit();
How 307 Redirects Affect SEO
SEO Search engines handle temporary and permanent redirects differently. This is how 307 redirects affect your site’s SEO:
1. No Link Equity Passing: A 307 redirect will not allow any link juice to pass since it does not help rank the new URL.
2. Crawling & Indexing: Because the move is temporary, search engines may index the original URL instead of the redirect.
3. Risk of Duplicate Content: If search engines index both URLs, you’ll have the potential for duplicate content issues.
4. Not Great for Overall SEO: If you’re looking to improve SEO or otherwise mitigate a deprecated page, use a 301 redirect.
Common Issues & Troubleshooting
Learn about common problems with 307 redirects along with solutions to fix them.
1. Redirection Loop: Double-check and make sure that the redirect is not pointing to itself, which will cause an infinite loop.
2. Wrong Status Code: Make sure to be using a 307 response for a temporary redirect and not a 302 or 301.
3. Caching: Once the browser has cached a 307 redirect for a URL, requests to that URL will never receive a 307 header again. You would need to clear your cache to fix this.
4. Confusion to Search Engine Bots: Constantly switching 307 redirects to a 301 redirect creates unsure signals to the search engine. (307 indicates a temporary redirect, while 301 indicates a permanent redirect)
Conclusion
It is easy to see why 307 redirects can be extremely helpful when having a temporary redirect while still retaining the HTTP methods. A 307 redirect is ideal when you want to perform server maintenance, A/B testing, secure login/redirection to another web application, etc. A 307 redirect is not adequate for SEO. If it is a permanent move, then consider the 301 redirects instead. When creating a 307 redirect, you need to look for how to choose the proper method based on whether you are using Apache, Nginx, PHP, JavaScript, etc. It is also essential to confirm that you set the appropriate configuration to avoid having redirect loops or caching issues.
If you are looking for a long-term SEO benefit, consider looking at a 301 redirect. However, for temporary purposes, the 307 redirect status code is an effective and reliable solution. Is there a website that you would like help with implementing 307 redirects? Please let us know in the comments below!