307 Redirects

307 Redirects
307 Redirects
Quick Summary of 307 Redirects

A 307 HTTP status code indicates a temporary redirect, meaning the requested resource has been temporarily moved to the URL specified in the Location header. Unlike a 302 redirect, which can be somewhat ambiguous, the 307 status code—introduced with HTTP/1.1—explicitly confirms that the resource is temporarily relocated. This ensures that clients understand the change is not permanent and that the original URL will be restored in the future.

Full Overview Of 307 Redirects

A 307 redirect (commonly known as a “307 temporary redirect”) is an HTTP status code that temporarily redirects visitors from one URL to another. It’s often employed for site maintenance, content updates, or similar purposes.

However, improper use can result in:

  • Website errors
  • Lower rankings on search engine results pages (SERPs)
  • A poor user experience

In this guide, we’ll cover how the 307 redirect functions, the best situations for using it, how to set it up properly, and some best practices to follow.

We’ll also explore the concept of a 307 internal redirect, which, while not an official HTTP status code, plays an important role in enhancing website security.

But first, let’s explore the broader category of 3xx status codes to understand where the 307 redirect fits in.

Understanding URL Redirections

All HTTP status codes in the 3xx range are related to URL redirection.

How Do They Work?

When someone attempts to access a webpage, their browser sends a “request” to the server that hosts the site. In response, the server returns an HTTP status code that indicates the page’s status.

Understanding URL Redirections

If the server needs to direct the browser to a different location, it responds with a 3xx status code.

Here’s a simplified breakdown of the most common 3xx codes:

  • 300 Multiple Choices: The browser has several options for the requested resource.
  • 301 Moved Permanently: The requested page has been permanently moved to a new URL.
  • 302 Found: The page is temporarily available at a different location.
  • 303 See Other: After a user action (like submitting a form), they are redirected to a different page to prevent duplicate submissions.
  • 304 Not Modified: The requested content hasn’t changed since the last visit, so the browser uses its cached version.
  • 307 Temporary Redirect: The page is temporarily redirected to a new URL, but the original request method (e.g., POST) remains unchanged.
  • 308 Permanent Redirect: Similar to a 301 redirect, it ensures that the original request method is preserved.

The 302, 303, and 307 codes all indicate temporary redirections but serve different purposes. So, how do they differ?

Explaining 302, 303, and 307 Redirects

There are three types of temporary 3xx redirects: 302, 303, and 307, each serving a specific function.

The key difference between these redirects lies in how they handle GET and POST requests—two common types of browser requests sent to a server:

  • GET: Used when a user simply wants to view a page.
  • POST: Used when a user needs to send data to the server (such as submitting a form).

302 Redirect

A 302 redirect is often used when content is temporarily moved to another URL. However, it can unintentionally convert a POST request into a GET request. This can interfere with a user’s intent. For example, if someone submits their email to sign up for a newsletter, the request might change, preventing their email from being added to the subscription list.

303 Redirect

The 303 status code ensures that all requests, regardless of the original type, are converted into a GET request after redirection. This is useful when you want to avoid duplicate submissions—like after a form is completed—by redirecting the user to a confirmation page. However, since it converts all requests to GET, it may not align with the user’s intent if data submission was involved, which is why the 303 redirect is not commonly used.

307 Redirect

The 307 redirect preserves the original request method, ensuring that a POST request remains a POST request after redirection. This is crucial for maintaining the integrity of data submissions, such as when users are sending sensitive information or completing forms. By keeping the request type intact, it ensures that data reaches its intended destination securely.

While all three of these redirects indicate a temporary change, the 307 status code is generally the best choice, especially when data submission or form processing is involved, as it maintains the original request method and protects user data.

307 Temporary Redirects & 307 Internal Redirects

A 307 temporary redirect is a server-side instruction that tells browsers to temporarily reroute traffic from one URL to another. It’s intended for short-term use.

On the other hand, a 307 internal redirect isn’t an official HTTP status code but is commonly used in web server configurations. It is a browser-initiated redirect designed for a specific purpose: seamlessly redirecting visitors from the HTTP version of your site to the secure HTTPS version. This serves as a permanent security measure to safeguard user data.

When someone visits your website, their browser communicates with your server using one of two protocols:

  • HTTP: A plain-text communication protocol.
  • HTTPS: An encrypted communication protocol, where the “S” stands for “secure”.

While every website has a non-secure HTTP version, implementing HTTPS adds an additional layer of protection. However, simply having an HTTPS site isn’t enough because users may still access the HTTP version. To ensure they are automatically redirected to the secure version, a 307 internal redirect is used.

This can be achieved by enabling HSTS (HTTP Strict Transport Security), which instructs browsers to always use HTTPS instead of HTTP. When HSTS is enabled, the browser automatically triggers a 307 internal redirect whenever a user attempts to access the HTTP version of your site.

The benefit? By enforcing 307 internal redirects through HSTS, you ensure that all data exchanged between your site and its visitors remains encrypted, keeping it secure from potential threats.

How to Implement a 307 Redirect

Setting up a 307 redirect can be done in several ways, depending on factors such as your website’s platform (e.g., WordPress, Joomla, custom-built), your level of technical expertise, the tools you’re familiar with, and your specific objectives for using a temporary redirect.

Below are three of the most commonly used methods:

Modifying the .htaccess File

The .htaccess file is a configuration file used primarily by Apache web servers to control how the server responds to various requests, including redirects. By editing this file, you can implement a 307 redirect effectively.

One advantage of using the .htaccess file is that it provides centralised control over all your redirects, making it easier to manage them from a single location. In contrast, other methods may require setting up each redirect individually.

Important Note: Be cautious when editing the .htaccess file, as incorrect changes can disrupt your website. Always back up both your website and the .htaccess file before making any modifications. If you’re unsure, consult with an expert.

Steps to Implement a 307 Redirect:

  1. Log in to your website’s hosting account and navigate to your site’s root directory (often named public_html).
    • For example, in hosting platforms like Bluehost, you’ll find the root directory labeled as public_html.
  2. Locate the .htaccess file within the public_html folder and open it for editing.
  3. Check if “RewriteEngine” is enabled by looking for the line:
    graphql
    RewriteEngine On
    • If it’s missing, you’ll need to add it.
  4. At the end of the .htaccess file, add the following code:
    bash
    Redirect 307 /oldpage.html /newpage.html
    • Replace /oldpage.html with the path of the page you want to redirect, and /newpage.html with the destination URL.
  5. Save your changes and test to ensure that the redirect is functioning correctly.

Note for Other Server Types:

If your site runs on a server other than Apache (like Nginx or IIS), the process varies. You’ll need to adjust the configuration file specific to that server type. Always consult your server’s documentation or seek expert advice if needed.

Using Plugins

If your website runs on a content management system (CMS) like WordPress, setting up a 307 redirect can be straightforward with the help of a plugin.

Simply search for a redirection plugin within your CMS’s plugin repository or on reputable third-party platforms. Once you’ve found a suitable one, install and activate it, then follow the plugin’s instructions to configure your redirects.

For example, let’s look at WordPress:

  1. Install the Redirection plugin, a popular and free solution for managing redirects.
  2. Log in to your WordPress dashboard, navigate to “Plugins” in the sidebar, search for “Redirection,” and click Activate.
  3. Once activated, go to “Tools” > “Redirection” to open the plugin settings.
  4. From there, you can easily set up your 307 redirect rules by specifying the source URL and the target destination.

This method is ideal for those who prefer a user-friendly interface without having to edit server files directly.

Using Programming Languages

For those looking for a more hands-on approach, programming languages offer direct control over when and how redirects occur. This method is ideal if you want to customise redirects based on user actions or specific conditions. Additionally, it allows for faster, more integrated setups without relying on additional tools or plugins.

PHP and JavaScript are two popular options for implementing 307 redirects. Here’s how to set them up:

Important Note: Editing code directly can impact your site’s functionality, so always create backups before making changes.


Implementing 307 Redirects in PHP

PHP, a server-side scripting language, is commonly used in web development. To set up a 307 redirect using PHP, you can use the header() function to send a location header, which instructs the browser to redirect.

Steps:

  1. Open the PHP file where you want to implement the redirect.
  2. At the very top, before any other content, add the following code:
    php
    <?php
    header("Location: /new-url/", true, 307);
    exit;
    ?>
    • Replace /new-url/ with the path to your desired destination.
  3. Save the file and test it by accessing the original page to ensure the redirect works properly.

Implementing 307 Redirects in JavaScript

JavaScript is a client-side scripting language, meaning the redirect happens in the user’s browser after the page starts loading. However, this method is not as SEO-friendly as server-side redirects, as it may cause delays and not all search engines reliably execute JavaScript.

Steps:

  1. Locate the HTML file of the page you want to redirect.
  2. In the <head> section, preferably right before the closing </head> tag, insert the following script:
    html
    <script type="text/javascript">
    window.location.replace("/newpath/");
    </script>
    • Replace /newpath/ with the path of your target URL (e.g., /about-us/).
  3. Save the changes and test the redirect by accessing the original page.

When Should You Use a 307 Redirect?

Now that you understand how to implement a 307 redirect, it’s important to know when it’s the right choice. This type of redirect is useful for temporary changes where you want to maintain the original request method (GET or POST), such as during site maintenance or content updates, without affecting SEO in the long term.

Site Maintenance

A 307 redirect is ideal for temporarily directing users away from pages that are unavailable due to updates or maintenance. Instead of encountering an error, visitors are seamlessly redirected to an alternative page. Once maintenance is complete, simply remove the redirect to restore access to the original page.

A/B Testing

If you’ve recently redesigned a landing page and want to test its effectiveness compared to the existing version, a 307 redirect can be used. By temporarily redirecting all traffic from the original page to the new design, you can monitor user engagement. At the end of the test, if the new design performs better, you can make it permanent. If not, it’s easy to revert traffic back to the original layout.

Temporary Content Relocation

Let’s say you’ve hosted a weeklong online event and created a dedicated landing page for it. Once the event concludes, you may need some time to analyse engagement and gather feedback. To prevent visitors from accessing outdated content, you can temporarily redirect them to a related summary page using a 307 redirect. Once you’ve updated the event page with highlights or post-event content, you can remove the redirect to restore direct access.

Transitioning Between HTTP and HTTPS

When securing your site by moving from HTTP to HTTPS, the HSTS (HTTP Strict Transport Security) feature can be used to enforce secure connections. HSTS prompts browsers to always use HTTPS. If a user attempts to access the HTTP version, the browser automatically performs an internal 307 redirect to the HTTPS version. This ensures a fully encrypted connection, protecting user data effectively.

When You Should Avoid Using a 307 Redirect

For Permanent URL Changes

If a page has been permanently moved to a new URL, using a 307 temporary redirect isn’t the right approach. Instead, you should use a 301 permanent redirect to clearly signal to search engines that the change is permanent.

To identify any existing 307 redirects on your site that should be updated to 301s, you can use tools like Semrush’s Site Audit. Here’s how:

  1. Open the Site Audit tool, enter your domain, and click on “Start Audit.”Example: Running a site audit to find redirects
  2. Once the audit is complete, go to the “Overview” report and find the “Crawled Pages” widget. Click on the number listed under “Redirects.”Example: Viewing the “Crawled Pages” widget in the Site Audit dashboard
  3. Review the URLs flagged with a 307 status code. If any of these pages have been permanently moved, update them to use 301 redirects. For detailed instructions, refer to our guide on setting up 301 redirects using the .htaccess file.Example: Filtering for temporary redirects (3xx status codes) in the Site Audit report

By making this change, you ensure search engines recognise the permanent move, which helps preserve your site’s SEO value.

For Bulk Redirects

If you’re restructuring your entire website or changing its domain, setting up individual 307 redirects for each page can be time-consuming and inefficient. It may also negatively impact your site’s loading speed.

From an SEO standpoint, having too many individual redirects can confuse search engine crawlers and potentially harm your site’s rankings.

A more efficient solution is to use wildcards or pattern-based redirects, which allow you to redirect multiple related URLs with a single rule.

For example, using a pattern like "/blog/*" will redirect all pages under the /blog/ directory to a new location in one step, simplifying the process and reducing server load.

SEO Impact of 307 Redirects

Now that you understand when to use (and avoid) a 307 redirect, it’s also important to consider its potential SEO implications:

  • Link Equity Transfer: While a 307 redirect can temporarily pass the original page’s SEO value to the redirected page, it doesn’t transfer that value permanently. Search engines treat it as a temporary change, expecting the original URL to be restored eventually. As a result, the SEO benefits are not fully retained.
  • Treatment by Search Engines: Both 307 and 302 redirects are considered temporary, with similar impacts on SEO. The main distinction between them is in how they handle browser requests, not in how they transfer SEO value.

To avoid potential SEO issues, it’s crucial to manage 307 redirects correctly. Proper implementation ensures that your site’s search engine rankings remain stable while still achieving your redirection goals.

Best Practices for Using 307 Redirects

Handling 307 redirects requires careful planning. Follow these best practices to ensure they are used effectively:

Test All Redirects

After setting up a 307 redirect, always test it to confirm it works as intended. Visit the old URL and check that it smoothly redirects to the correct new location.

Monitor Redirect Performance

Regularly track the performance of your redirects using analytics tools. Pay attention to how users interact with redirected pages. If you notice unusual patterns or increased bounce rates, reassess your redirect strategy to improve user engagement.

Review and Update Redirects

As your website evolves, some 307 redirects may become obsolete. Periodically review redirects to identify any that are no longer needed or may be causing errors (often referred to as “307 error codes”). Update or remove these redirects as necessary to keep your site running efficiently.

Limit Redirect Chains

Avoid creating redirect chains where one page redirects to another, which then redirects to yet another page. This can slow down page loading times and negatively impact user experience. Aim for direct, single-step redirects whenever possible.

  • Tools like Semrush’s Site Audit can help identify redirect chains. After running an audit, check the “Issues” tab for any “redirect chains and loops” that need fixing.

Keep User Experience in Mind

Always consider the user’s journey. Redirects should lead to relevant, high-quality content that meets user expectations. If a redirect takes users to an unrelated page, it can lead to dissatisfaction and increased bounce rates.

Avoid Frequent URL Changes

Using 307 redirects repeatedly on the same URL can send mixed signals to search engines. Frequent changes can make search engines question the stability and relevance of your content, potentially lowering your rankings. Use 307 redirects judiciously and ensure content remains stable to maintain SEO performance.

Prioritise Security

When using redirects as part of a move to HTTPS, ensure that all site elements are fully secure. This includes checking for “mixed content” issues, where some resources (e.g., scripts, plugins) still load over HTTP. Update any non-secure resources to HTTPS to prevent vulnerabilities.

Document Your Redirects

Maintain a record of all active redirects to help troubleshoot and provide a reference for future site managers. Proper documentation can streamline updates and reduce the risk of errors when making changes to your site.

Troubleshooting Common 307 Redirect Issues

Implementing a 307 redirect is usually straightforward, but misconfigurations can still occur. Here are some solutions to address common issues:

Check Server Configuration

Reviewing your server configuration ensures that all redirect rules are correctly set up. For instance, users may encounter errors or confusion if you’re trying to redirect an old product page to a new one but accidentally point to a non-existent or irrelevant page.

To avoid such issues, periodically check your server settings to confirm that redirects point to the correct destinations. You can typically access and adjust these settings through your hosting provider’s control panel.

Review Server Logs

Analysing server logs can help you identify the root causes of unexpected 307 redirects. This can be particularly useful if you notice unusual redirect behaviour. By examining these logs, you can:

  • Identify URLs that frequently trigger redirects, which may indicate misconfigurations.
  • Detect any recent changes or unexpected settings that could be causing redirects, especially after updates or if multiple users have access to your server.
  • Spot patterns in user behaviour, such as redirects occurring after form submissions or when outdated links are accessed.

Once you’ve pinpointed the cause, you can adjust your redirect rules accordingly.

Additional Fixes

  • Verify URL Accuracy: Ensure the URLs used in your redirect rules are correctly configured. A typo or misconfiguration can lead to unexpected redirect behaviour.
  • Clear Cache: Outdated redirects may still be stored if your website uses caching. Clear your server-side cache to ensure that changes take effect immediately.
  • CMS and Platform-Specific Issues: If you use a content management system (CMS), consult its guidance documentation. Some platforms have unique ways of handling redirects, or certain plugins may cause unexpected 307 redirects.

Seek Professional Help for Complex Issues

If you’re experiencing complex redirect loops, multiple chained redirects, or other persistent problems, it may be time to consult a web developer or server expert. They can provide more in-depth troubleshooting and ensure your redirects function as intended.

Putting It into Practice

Now that you’re familiar with a 307 redirect, how it works, and how to set it up, it’s time to put that knowledge into action.

Start by auditing your website using a tool like Site Audit to generate a detailed report on all your redirects. Once you have the report, review the URLs with a 307 status code and assess the following:

  • Are they being used correctly and pointing to the appropriate destination?
  • Do any need to be updated to a different HTTP status code, such as a 301 or 302?
  • Are there misconfigurations, like redirect chains, that need fixing?
  • Should any of the 307 redirects be removed entirely?

Based on your findings, make the necessary adjustments to ensure your redirects are optimised and functioning properly.

Cite Term

To help you cite our definitions in your bibliography, here is the proper citation layout for the three major formatting styles, with all of the relevant information filled in.

  • Page URL:https://seoconsultant.agency/define/307-redirects/
  • Modern Language Association (MLA):307 Redirects. seoconsultant.agency. TSCA. November 20 2024 https://seoconsultant.agency/define/307-redirects/.
  • Chicago Manual of Style (CMS):307 Redirects. seoconsultant.agency. TSCA. https://seoconsultant.agency/define/307-redirects/ (accessed: November 20 2024).
  • American Psychological Association (APA):307 Redirects. seoconsultant.agency. Retrieved November 20 2024, from seoconsultant.agency website: https://seoconsultant.agency/define/307-redirects/

This glossary post was last updated: 12th November 2024.

Avatar of Peter Wootton
Peter Wootton : SEO Consultants

I am an exceptionally technical SEO and digital marketing consultant; considered by some to be amongst the top SEOs in the UK. I'm well versed in web development, conversion rate optimisation, outreach, and many other aspects of digital marketing.

All author posts
75% of users never scroll past the first page of search results.
HubSpot