What Is a 307 Redirect?
A 307 redirect (also known as “307 non permanent redirect”) is an HTTP standing code that quickly diverts web site guests from one URL to a different. The 307 standing code is usually a great tool for website upkeep, content material updates, and extra.
However mismanaging it may well result in:
- Web site errors
- Decrease rankings on search engine outcome pages (SERPs)
- Poor person expertise
On this article, you’ll find out how the 307 redirect works, when to make use of it, the way to set it up, and a few finest practices.
We’ll additionally clarify 307 inside redirect, which isn’t an HTTP standing code however performs a job in web site safety.
Let’s begin by trying on the wider household of 3xx standing codes.
Understanding the 3xx Standing Codes
All HTTP standing codes with a 3xx quantity take care of URL redirection.
How do they work?
When somebody tries to entry your webpage, their browser forwards a “request” to your website’s server (a system that hosts and delivers internet content material).
The server responds with a message indicating the web page’s standing. This message is known as an HTTP standing code.
If there’s a purpose for the browser to be guided to a special location, the server sends a 3xx standing code.
Listed here are the 3xx codes in simplified type:
- 300 a number of selections: The browser can select between a number of choices for the requested web page
- 301 moved completely: The requested web page has a brand new everlasting handle
- 302 discovered: The requested web page has a brand new handle for a short while
- 303 see different: After an motion like submitting a type, the person is shipped to a different web page to forestall duplicate submissions
- 304 not modified: The requested web page hasn’t modified because the person’s final go to, so the browser can use its cached model
- 307 non permanent redirect: The requested web page is quickly at a special handle
- 308 everlasting redirect: The requested web page has moved completely
The 302, 303, and 307 codes are non permanent redirects. So how are they completely different?
302, 303, and 307 Redirects: What’s the Distinction?
There are three sorts of non permanent 3xx redirects: 302, 303, and 307. Every has a novel perform.
The primary distinction between these redirects is how they deal with GET and POST requests—two frequent sorts of requests despatched by a browser to a server when a person tries to entry a webpage:
- GET: When a person solely desires to view a web page
- POST: When a person desires to ship information to the server (e.g., when submitting a type)
302 Redirect
When a person tries to submit a type or different information (a POST request), the 302 redirect may change the request to a GET request.
This could battle with the person’s intention.
For example, if a person is making an attempt to join a publication, their e-mail won’t be added to the subscription record as a result of change in request kind.
303 Redirect
The 303 standing code turns all request varieties right into a GET request. It’s thought of non permanent as a result of it’s tied to solely one among a number of actions out there to a website customer, akin to submitting a type.
After a type submission, the 303 code sends the person to a special location utilizing a GET request. This avoids the chance of resubmission if the person hits the refresh button.
However by turning all request varieties right into a GET request, the 303 standing code can battle with the person’s intent. Because of this the 303 redirect isn’t broadly used.
307 Redirect
In contrast to the 302 and 303 codes, the 307 redirect maintains the integrity of the unique request methodology. A POST request, for instance, stays a POST request after the redirect.
Sustaining the proper request kind ensures that type submissions and different despatched information attain their meant vacation spot and permits the web site to higher shield delicate person info.
Though all three redirects point out a short lived transfer, the 307 standing code is your best option, particularly when information submission is concerned.
307 Momentary Redirect vs. 307 Inside Redirect
A 307 non permanent redirect is a server-side instruction that tells browsers to quickly redirect visitors from one URL to a different. It’s a short-term measure.
A 307 inside redirect isn’t an official HTTP standing code however is usually utilized in internet server configurations. It’s a browser-initiated redirect for a really particular goal: to direct guests away from the HTTP model of your website to the safer HTTPS model.
It’s a everlasting safety measure to guard person information.
When somebody visits your web site, their browser communicates together with your web site’s server. This communication could be:
- HTTP: A plain-text communication protocol
- HTTPS: An encrypted communication protocol, the place the “S” stands for “safe”
Each web site has a non-secure HTTP model. However should you’ve applied safety practices, you have got an HTTPS model, too.
Nonetheless, simply having an HTTPS website isn’t sufficient. Guests may nonetheless land in your HTTP website. To stop this, you want a seamless redirect to your HTTPS model. That is the job of the 307 inside redirect.
By enabling HSTS (HTTP Strict Transport Safety), you may set off these 307 inside redirects in a customer’s browser.
HSTS is a safety function that instructs browsers to all the time use HTTPS as a substitute of HTTP.
The outcome: When a person tries to entry your website by way of HTTP, the browser routinely redirects them to the HTTPS model.
Utilizing the 307 inside redirects by way of HSTS ensures that customers’ information stays encrypted and safe from potential threats.
The way to Set Up a 307 Redirect
There are a number of methods to implement a 307 redirect. The tactic of selection relies on your website’s platform (e.g., WordPress, Joomla, custom-built), your technical experience, the instruments you’re comfy with, and your particular objectives for the non permanent redirect.
Listed here are the three most typical strategies:
1. Enhancing the .htaccess File
The .htaccess file is a configuration file primarily utilized by Apache internet servers.
This file instructs your server how to reply to varied eventualities, together with redirects.
You’ll be able to implement a 307 redirect by modifying this file.
Amongst different advantages, the .htaccess file provides you centralized management. You’ll be able to conveniently handle all of your redirects from this single file. Different strategies require organising every redirect individually.
Word
Proceed with warning. Incorrect modifications to the .htaccess file could cause issues in your web site. Create a backup of your web site and the .htaccess file earlier than continuing. If wanted, seek the advice of an knowledgeable.
Log in to your web site’s internet hosting account. Then navigate to the basis listing, which is your web site’s essential folder.
For instance: If Bluehost is your hosting supplier, your root listing will look one thing like this:
Find the .htaccess file contained in the “public_html” folder. Open it to edit.
Now do the next:
- Test if “RewriteEngine” is on. You may see a line within the file that claims RewriteEngine On. (See the screenshot under) If it’s not there, it is advisable to add it.
- Add the next code on the finish of the .htaccess file:
Redirect 307 /oldpage.html /newpage.html
Ensure to exchange /oldpage.html with the trail of the web page you’re redirecting from and /newpage.html with the vacation spot web page’s path.
Save the file. And take a look at to see whether or not the redirect is working correctly.
If you’re utilizing a server kind apart from Apache (e.g., Nginx or IIS), the method is completely different. However the precept stays the identical: You’ll must edit a configuration file particular to that server.
Ensure to verify your server’s documentation or search knowledgeable recommendation.
2. Plugins
Does your website use a content material administration system (CMS) akin to WordPress? Then implementing a 307 redirect is straightforward by way of a plugin.
Merely seek for a redirection plugin in your CMS’s plugin retailer or on third-party platforms.
Set up and activate the plugin. Then observe its directions.
Let’s take WordPress for example.
The Redirection plugin is a well-liked free answer for dealing with your redirects.
Log in to your WordPress dashboard. Click on “Plugins” within the sidebar, seek for “redirection,” and activate it.
Then head to “Instruments” > “Redirection” to open the plugin.
Now enter your 307 redirect guidelines.
Additional studying: The way to Redirect URLs on WordPress
3. Programming Languages
Programming languages provide a extra hands-on strategy to organising redirects.
This methodology is good if you’d like direct management over how and when redirects occur. Programming languages allow you to redirect customers primarily based on particular actions they take or particulars they supply.
In addition they enable for quicker and extra built-in setups with out the necessity for extra instruments or plugins.
PHP and JavaScript are two well-liked languages. Right here’s how you should utilize them to implement 307 redirects:
Word
Making adjustments immediately in programming information can have an effect on your web site’s performance. All the time create backups of your information and be cautious when enhancing.
Redirects in PHP
PHP is a server-side scripting language generally utilized in internet improvement.
To arrange a 307 redirect utilizing PHP, use the “header()” perform to ship a location header to the browser, instructing it to redirect to a brand new URL.
Open the PHP file from which you wish to redirect.
On the prime, earlier than any content material, insert:
<?php
header("Location: /new-url/", true, 307);
exit;
?>
Exchange /new-url/ together with your desired vacation spot.
Save the file and take a look at the redirect by accessing the unique web page.
Redirects in JavaScript
JavaScript is a client-side scripting language.
Organising redirects in JavaScript isn’t as Search engine marketing-friendly as server-side strategies.
The redirects happen solely after the web page begins loading, thereby inflicting a delay. And never all serps execute JavaScript or accomplish that constantly.
Discover the HTML file of the web page you want to redirect.
Within the <head> part of your HTML file, ideally above “</head>.”
Insert the next script:
<script kind="textual content/javascript">
window.location.exchange("/newpath/");
</script>
Exchange “newpath” together with your desired vacation spot URL. For instance, if you wish to redirect to a web page with the URL https://yourwebsite.com/about-us, you’ll exchange /newpath/ with /about-us/.)
Save your adjustments to the HTML file. Then take a look at the redirect by accessing the unique web page.
Now that you recognize some methods to implement a 307 redirect, when is it essential?
When to Use a 307 Redirect
Website Upkeep
Use a 307 redirect for pages which can be unavailable for a restricted time on account of updates or upkeep. In any other case, guests will see an error message.
Merely take away the redirect as soon as the upkeep is full.
A/B Testing
Suppose you’ve redesigned your touchdown web page. And also you wish to see if it engages your viewers higher than the present model.
For this experiment, you may determine that for a restricted time, all incoming visitors to the unique web page must be redirected to the brand new design utilizing a 307 redirect.
Throughout this era, all guests will expertise the brand new design.
As soon as your A/B take a look at is over, you may make the brand new design everlasting primarily based on constructive outcomes. Or revert to the unique structure if it proves simpler.
Momentary Content material Relocation
Suppose you’ve hosted a weeklong on-line occasion with a devoted touchdown web page. After the occasion, you want time to investigate engagement and collect suggestions.
Throughout this interim evaluation part, you don’t need guests to entry the occasion web page immediately.
You’ll be able to quickly divert guests to a associated abstract web page utilizing a 307 redirect.
When you’re able to showcase the occasion’s outcomes, highlights, or any post-event content material, you may take away the 307 redirect, permitting guests to entry the up to date occasion web page.
Transitioning Between HTTP and HTTPS
If you safe your web site by shifting from HTTP to HTTPS, you’ll use the HSTS function.
HSTS tells browsers to all the time use HTTPS as a substitute of HTTP.
If a person tries to entry the HTTP model of your website, the browser will routinely use an inside 307 redirect to take them to the safe HTTPS model.
This ensures an encrypted connection, defending their information.
When To not Use a 307 Redirect
For Everlasting URL Modifications
In the event you’ve completely moved a web page to a brand new URL, a 307 non permanent redirect isn’t proper.
As a substitute, it’s best to use a 301 everlasting redirect to sign the change to serps.
You should utilize Semrush’s Website Audit device to establish pages in your web site with 307 redirects. After which change them to 301 if these pages have been completely moved.
Open the device, enter your area, and click on “Begin Audit.”
As soon as the audit is full, open the “Overview” report and search for the “Crawled Pages” widget. Click on on the variety of “Redirects.”
Evaluation all of the URLs with a 307 standing code. If any of those pages have been completely moved, implement 301 redirects. Check with our information on organising 301 redirects utilizing an .htaccess file.
It’s also possible to apply an HTTP Standing filter to this report back to see solely pages with a “3xx non permanent” standing code.
For Bulk Redirects
In the event you’re restructuring your complete web site or altering its area, utilizing particular person 307 redirects for every web page could be inefficient and should decelerate your website’s loading time.
From an Search engine marketing perspective, extreme particular person redirects can confuse search engine crawlers, doubtlessly impacting your website’s rankings.
As a substitute of individually redirecting every web page, it’s extra environment friendly to make use of “wildcards” or “pattern-based redirects.”
These shortcuts permit you to redirect a number of related URLs by way of a single rule.
For instance, you should utilize the sample “/weblog/*” to redirect all pages below the “/weblog/” listing to a brand new location.
Search engine marketing Implications of 307 Redirects
Now that you recognize when and when to not use a 307 redirect, you must also concentrate on its Search engine marketing implications. Right here’s a fast breakdown:
- How hyperlink juice transfers: 307 redirects could quickly cross on the unique web page’s Search engine marketing worth to the redirected one. However as a result of this can be a non permanent redirect, serps anticipate the unique URL to be accessible once more sooner or later. Consequently, the Search engine marketing worth isn’t transferred completely.
- How 307 and 302 redirects are handled by serps: Each are non permanent redirects, and their Search engine marketing impression is comparable. The important thing distinction is in how they deal with browser requests—not of their switch of Search engine marketing worth.
When utilizing 307 redirects, you should definitely think about their potential impression on Search engine marketing. Managing them appropriately will keep away from errors and assist preserve the SERP rankings of your URL.
Greatest Practices for 307 Redirects
There’s loads to think about when dealing with 307 redirects. Observe these finest practices to make sure optimum outcomes:
Check All Redirects
After organising a 307 redirect, all the time take a look at it to make sure it’s working as meant.
To take action, merely go to the outdated URL and verify whether or not it easily redirects to the specified new location.
Monitor Redirect Efficiency
Often verify the efficiency of your redirects. You should utilize analytics to observe how customers are interacting with redirected pages.
In the event you discover any anomalies or elevated bounce charges, it is perhaps time to re-evaluate your redirect technique.
Evaluation and Replace
As your web site evolves, some 307 redirects could not be essential.
Periodically evaluate your 307 standing code to verify for errors (also known as a “307 error code” when the redirect isn’t working appropriately). And repair them—both by updating or eradicating them.
Restrict Redirect Chains
Keep away from creating chains of redirects (e.g., Web page A redirects to Web page B, which then redirects to Web page C, and so forth).
This could sluggish the web page’s loading time and create a poor person expertise. Purpose for direct, one-step redirects at any time when doable.
You should utilize Semrush’s Website Audit device to establish redirect chains that want fixing. Audit your web site. Then head to the “Points” tab of your report.
You’ll now see all the problems Semrush discovered in your web site. Together with any “redirect chains and loops.”
Evaluation and repair the difficulty. Purpose to have every hyperlink redirected solely as soon as.
Hold Person Expertise in Thoughts
If a redirect results in a web page that isn’t related or doesn’t meet the person’s expectations, it may well trigger dissatisfaction.
So all the time think about the person’s perspective. Make sure that your redirects result in related, high-quality content material.
Keep away from Frequent URL Modifications
Utilizing 307 redirects regularly on the identical URL can ship combined indicators to serps.
When serps detect {that a} specific URL’s vacation spot is regularly altering, they could turn out to be unsure in regards to the stability and relevance of that content material.
Consequently, the search engine won’t rank the content material extremely.
So use redirects judiciously. And be sure that content material stays constant for optimum search efficiency.
Prioritize Safety
In the event you’re utilizing redirects as a part of a transition to HTTPS, be sure that all points of your website are safe. This prevents “combined content material” vulnerabilities.
What do you have to do?
Test whether or not your website’s exterior assets, plugins, and scripts are appropriate with HTTPS. If not, exchange them.
Doc Your Redirects
Hold monitor of your energetic redirects to assist with future troubleshooting and to maintain future web site managers knowledgeable.
The way to Repair 307 Momentary Redirect Points
It’s straightforward to implement a 307 redirect. Nonetheless, you should still face sure points or misconfigurations. Listed here are some frequent options:
Test Server Configuration
Checking your server configuration helps you guarantee all redirect guidelines are functioning as meant.
For instance, suppose you wished to arrange a redirect for an outdated product web page to a brand new one. In the event you mistakenly set the rule to redirect customers to a web page that not exists or to an unrelated part of your website, guests will encounter errors or confusion.
To keep away from such errors, usually evaluate the redirect guidelines in your server settings. Ensure they’re pointing to the proper locations. These settings are usually accessible and adjustable in your internet hosting supplier’s management panel.
Evaluation Server Logs
Analyzing server logs may also help you establish the basis causes of sudden 307 redirects. By analyzing these logs, you may:
- Decide which URLs are regularly inflicting redirects. This may also help if sure pages are misconfigured or if there’s an error within the redirect guidelines.
- Spot any sudden configurations or adjustments that may have triggered the redirect. That is particularly helpful if there’s been a latest replace or if a number of folks have entry to your server settings.
- Acknowledge patterns of person habits or particular occasions resulting in the redirect, akin to type submissions or the accessing of outdated hyperlinks.
When you’ve recognized the basis causes, you may take the mandatory steps to repair the problems.
Different Fixes
- Make sure that the URLs arrange for redirects are appropriately configured. A misconfigured URL in your redirect guidelines can result in sudden habits.
- In case your web site has caching mechanisms in place, be sure that they aren’t caching outdated redirects. You may must clear or replace server-side caches.
- In the event you’re utilizing a CMS or a particular internet platform, verify its documentation. Some platforms might need anomalies in how they deal with redirects, or there is perhaps recognized points with sure plugins or configurations inflicting sudden 307 redirects.
- In the event you’re dealing with advanced redirect loops, a number of redirects chaining collectively, or different eventualities that you may’t resolve, think about searching for assist from an internet developer or server knowledgeable
Use 307 Redirects the Proper Manner
Now that you simply perceive what a 307 redirect is, the way it works, and the way to implement it, let’s get to work.
Audit your web site utilizing a device like Website Audit, and get a full report on all of your redirects.
Evaluation the URLs with the 307 standing code. And decide:
- Are they appropriately used and pointing to the precise vacation spot?
- Do they want an replace to a special HTTP standing code?
- Are there any unhealthy redirect configurations, like chain redirects?
- Must you take away the redirect?
Primarily based in your evaluation, make adjustments accordingly.