ARTICLE AD BOX
What Is a 307 Redirect?
A 307 redirect (often referred to arsenic an HTTP 307 presumption code) temporarily and automatically diverts website visitors from 1 URL to different portion maintaining the HTTP petition method—which is important for definite types of pages.
For example, accidental you’re redesigning your site’s login page. And you privation to temporarily redirect users from “yoursite.com/login/” to “yoursite.com/login-temp/” during the redesign.
A 307 redirect tin help. And users who effort to entree ”yoursite.com/login/” volition beryllium redirected to your impermanent login page.
How Do 3xx Status Codes Work?
A 3xx presumption codification (a 307 redirect is conscionable 1 type) tells web browsers to divert postulation from the archetypal URL to a antithetic URL.
When idiosyncratic tries to entree your temporarily redirected webpage, their browser sends a petition to your site’s server (the strategy that hosts and delivers web content).
The server responds with a 3xx HTTP presumption code that indicates the presumption of the leafage oregon enactment requested. And that presumption codification tells browsers wherever to spell adjacent and however to grip the redirection.
307 vs. 302 vs. 303 Redirects
307, 302, and 303 redirects are each impermanent redirects, but they disagree successful however and whether they support the HTTP petition type.
This mostly applies to 2 types of requests sent by a browser to a server:
- GET: When information is being retrieved from the server
- POST: When information is being sent to the server (like done a signifier submission)
Knowing the quality betwixt GET and POST requests helps you recognize the quality betwixt these redirects:
302 Redirect
A 302 redirect is simply a impermanent redirect that tin perchance alteration a POST petition into a GET request.
You tin usage it erstwhile you request to temporarily nonstop postulation to a caller determination and it doesn’t substance if the petition method changes. Like if you’re moving a impermanent merchantability and privation to redirect users to that limited-time leafage from your main merchandise leafage portion the merchantability is running.
303 Redirect
A 303 redirect is simply a impermanent redirect that changes each requests to a GET request, and it’s typically utilized erstwhile you privation to nonstop users to a caller leafage aft they execute an enactment similar submitting a form.
For example, if a idiosyncratic completes a signifier to download a assets connected your site, you tin usage a 303 redirect to nonstop them to a convey you leafage aft the submission gets processed. Which tin debar duplicate submissions.
307 Redirect
A 307 HTTP codification is simply a impermanent redirect that maintains the archetypal petition method—a POST petition remains a POST request.
Maintaining the petition method helps support data, debar information loss, etc.
For instance, you tin usage a 307 redirect to nonstop users to an bid confirmation leafage that contains immoderate of the aforesaid accusation the idiosyncratic submitted.
307 Temporary Redirect vs. 307 Internal Redirect
While a 307 impermanent redirect is simply a mode to temporarily nonstop users to a antithetic leafage than the 1 requested, a 307 interior redirect (this is an informal word and isn’t a existent redirect) is simply a mode to automatically nonstop users to the unafraid mentation of a website.
When idiosyncratic visits your website, the information transportation betwixt their browser and your server tin beryllium via:
- HTTP: A plain-text connection protocol
- HTTP Secure (HTTPS): An encrypted connection protocol that’s much secure
If your website uses HTTP Strict Transport Security (HSTS)—a information diagnostic that instructs browsers to ever usage HTTPS alternatively of HTTP—users volition ever extremity up connected the unafraid mentation of your site.
Chrome’s developer tools amusement this arsenic a “307 interior redirect.”
How Do 307 Redirects Affect SEO?
A due 307 redirect usually has minimal effects connected your site’s SEO due to the fact that it:
- Doesn’t walk nexus equity: Because 307 redirects are temporary, hunt engines expect the archetypal URL to beryllium accessible again successful the future. As a result, nexus equity isn’t mostly transferred.
- Doesn’t update the hunt results: Search engines volition typically proceed to scale the archetypal URL erstwhile they spot a impermanent redirect. And that means if the archetypal leafage is ranking, it volition proceed to amusement successful spot of the impermanent page.
That said, 307 redirects tin origin disorder to hunt engines if utilized agelong term. Which could negatively interaction your rankings.
When to Use a 307 Redirect and When to Avoid a 307 Redirect
Use a 307 redirect for:
- Temporary redirects that necessitate maintaining the HTTP petition method: Using a 307 redirect is indispensable erstwhile you request to marque definite a POST petition isn’t changed to a GET request
- Other impermanent needs: If you’re updating pages connected your tract oregon moving A/B tests (testing 2 variations to spot which performs better), you tin usage 307 redirects. Though 302 redirects are much communal for these scenarios.
Avoid 307 redirects for:
- Bulk redirects: If you’re implementing a batch of impermanent redirects, utilizing idiosyncratic 307 redirects for each leafage tin beryllium inefficient and whitethorn dilatory down your site’s loading time. Instead, usage wildcard oregon pattern-based redirects to redirect aggregate URLs based connected rules.
- Permanent URL changes: If you’ve permanently moved a leafage to a caller URL, a 307 impermanent redirect isn’t right. Instead, you should usage a 301 imperishable redirect to awesome the alteration to hunt engines.
How to Set Up a 307 Redirect
The mode you acceptable up a 307 redirect depends connected your website level (e.g., WordPress, Joomla, oregon custom-built), your method expertise, and your circumstantial goals for the impermanent redirect.
Here are 4 of the astir communal methods:
1. Edit the .htaccess File
The .htaccess file is simply a configuration record that instructs your server (assuming you usage Apache) however to respond to assorted scenarios, including redirects.
You tin instrumentality a 307 redirect by modifying this file.
Log successful to your website’s hosting account, spell to your record manager, and past navigate to the basal directory (your website’s main folder).
If Bluehost is your web hosting provider, your basal directory whitethorn look thing similar this:
Locate the .htaccess record wrong the basal directory and prime it to edit.
Now bash the following:
- Check for a enactment that says “RewriteEngine On” (see the screenshot below). If it’s not there, see adding it (you don’t strictly request it for this example, but it’s indispensable for adding rewrite rules)
- Add the pursuing codification astatine the extremity of the .htaccess file:
Redirect 307 /oldpage.html /newpage.html
Make definite to regenerate “/oldpage.html”with the comparative URL of the leafage you’re redirecting from and“/newpage.html”with the destination page’s comparative URL.
Save the file. And trial to spot if the redirect works.
2. Try PHP Redirection
Using PHP headers is different mode to bash a server-side redirect.
To acceptable up a 307 redirect utilizing PHP, usage the “header()” relation to nonstop a determination header to the browser and instruct it to redirect to a caller URL.
Open the PHP record that corresponds to the leafage you privation to redirect.
At the top, insert this earlier immoderate different content:
<?php
header("Location: /new-url/", true, 307);
exit;
?>
Replace “/new-url/” with your desired destination (it tin beryllium a comparative URL arsenic we’ve shown) and prevention the file. Test the redirect by accessing the archetypal page.
3. Use Plugins
Using a plugin is an effectual mode to instrumentality 307 redirects if you can’t—or don’t privation to—access your server files.
Here’s however to bash redirects connected WordPress:
Download the Redirection plugin, upload it to your WordPress site, and activate it.
Then caput to “Tools” > “Redirection” to unfastened the plugin.
Now, participate your 307 redirect rules by clicking the cogwheel icon to grow each input areas.
4. Use a JavaScript Redirect
Another enactment if you can’t modify your server files is to usage JavaScript to adhd a client-side redirect.
But mounting up redirects successful JavaScript isn’t arsenic SEO-friendly arsenic server-side methods.
Why?
Because the redirects hap aft the leafage starts loading, which tin origin a delay. And not each hunt engines execute JavaScript oregon bash truthful consistently.
Find the HTML record of the leafage you privation to redirect.
In the <head> conception of your HTML file, insert the pursuing script:
<script type="text/javascript">
window.location.replace("/newpath/");
</script>
Replace “/newpath/” with your desired destination’s comparative URL.
Save your changes to the HTML file. Then trial the redirect by accessing the archetypal page.
Best Practices for 307 Redirects
There’s a batch to see erstwhile handling 307 redirects. Follow these champion practices to guarantee optimal results:
- Test redirects regularly: Visit the aged URL to corroborate it redirects correctly to the updated page
- Monitor idiosyncratic behavior: Use analytics tools to way idiosyncratic interactions connected redirected pages. Issues similar accrued bounce rates mightiness bespeak idiosyncratic dissatisfaction, prompting a request for amended alternatives.
- Use redirects sparingly: Avoid excessively galore 307 redirects—they tin dilatory down your site
- Track redirects: Maintain a grounds of progressive redirects for easier troubleshooting and aboriginal reference
- Avoid redirect chains and loops: Redirect chains are erstwhile browsers initiate aggregate redirects earlier getting to their last destination. And loops hap erstwhile 2 URLs redirect to each other. Both of these tin dilatory the page’s loading clip and make a mediocre idiosyncratic experience.
So, marque definite you way immoderate 307 redirects you implement. And region them erstwhile you don’t request them immoderate more.
You tin usage Semrush’s Site Audit instrumentality to show pages connected your website with 307 redirects.
Open the tool, participate your domain, and click “Start Audit.”
Once the audit is complete, find the “Crawled Pages” module and click the fig adjacent to “Redirects.”
Review each the URLs with 307 presumption codes to spot whether immoderate are unintentional and request to beryllium removed.
To specifically look for immoderate redirect chains and loops, spell to the “Issues” report, participate “redirect” successful the hunt bar, and look for the “# redirect chains and loops issue.”
If you spot this error, click it to reappraisal the affected pages. And past instrumentality steps to code the issues.
How to Fix 307 Temporary Redirect Issues
You whitethorn look issues oregon misconfigurations aft implementing 307 redirects. Here are immoderate communal solutions:
- If you observe problems by monitoring your server logs oregon done Site Audit, reappraisal the modifications you made for the affected pages and code immoderate errors you see
- If your website has caching mechanisms successful place, guarantee that they’re not caching outdated redirects
- Check the documentation for your CMS oregon website level regarding redirects if you usage them to negociate redirects. And look into whether determination are known issues with definite plugins.
- If you’re facing analyzable redirect loops, chains, oregon different scenarios that you can’t resolve, question assistance from a developer
Use 307 Redirects the Right Way
Now that you recognize what a 307 redirect is, however to instrumentality one, and however to hole related issues, it’s clip to get to work.
Audit your website utilizing Site Audit to get a afloat study connected each your redirects to review.
Based connected your assessment, marque changes accordingly.