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.
