If you manage websites, an understanding of HTTP redirects is essential for reliable site performance. In this article, we’ll take a comprehensive look at 3xx HTTP status codes, so that you can understand how they work, how best to manage them, and their impact on SEO.
A URL redirect involves one web page address being mapped to another. There’s a range of reasons why redirecting is required for your site.
For example, moving to a new domain is one of the overriding causes to use URL redirection. Sometimes your former domain name is too long and complicated to remember, or some kinds of infringing activities force you to move from one domain to another.
Let’s take a closer look at other reasons to redirect your page:
Besides the main reasons listed above, there are some other cases to take into consideration. Redirecting will come in handy if you need to simplify and track display ads or cope with emergencies. Redirects help marketers with monitoring advertising responses. At the same time, web admins can fix any failed linking activity (error-driven notifications, mail chains) with the help of redirection.
To sum up, Google defines redirecting to control crawling and indexing (category of the Advanced SEO Documentation). Google Search Central explains HTTP redirects as the practice of performing a seamless transition, accessing a page through several URLs, correction of outdated URLs, and sending users from deleted pages to new ones, thereby excluding 404 not found errors.
The fundamental protocol on the Internet that’s used for transferring data and information control in hosting servers is called HTTP. The HyperText Transfer Protocol allows maintaining websites and providing communication between internet users and servers on the World Wide Web.
HTTP is the protocol used for information systems with different types of data: distributed, hypermedia, and collaborative. The main goal of the HyperText Transfer Protocol is to provide seamless internet-based interactions. HTTP defines modifications, and data transfer provides a web server and browser actions.
This request–response protocol works through TCP connections that are used for server communications. The Transmission Control Protocol allows internet searchers to interact with any available identified resources represented on the World Wide Web. User communication with web, video, and message servers takes place via HTTP. This way, clients can get access to web pages.
It’s worth noting that the HyperText Transfer Protocol uses proxies. They are special-purpose filters for content identification and analysis. HTTP proxies prevent users from low-quality sending and displaying files:
There are modes of the HTTP proxy operation. HTTP-Client is used for the protection of the user’s browser. It sends request messages to the server. An HTTP-Server is responsible for HTTP response connections. The principle of the HTTP proxy operation can be figured the following way:
The main benefits of the HTTP protocols are:
According to Hitech Whizz, there are other advantages of the HyperText Transfer Protocol to take into account:
HTTP is also notable for its web protocol-specific methods. They vary from one task to another. There are nine request methods to perform different web operations.
HTTP status codes are special elements that determine the server response and are presented as 3-rigid coherent symbols. Each HyperText Transfer Protocol code is used for REST API errors. It’s necessary to understand each HTTP status code to identify problems and solve them.
There are five classes of the status codes to take into consideration. There are informational response, successful, redirection, client error, and serve error categories. The first rigid indicates the class of the HTTP status code. Let’s take a closer look at each category of the responses:
It’s worth noting that some of the status codes and errors have a direct impact on SEO. While 1xx and 2xx classes don’t affect search engine optimization much (while having a 200 response is the best practice), 300-, 400-, and 500-level ones can negatively impact crawling and indexing your web pages. You should always take care to address 4xx and 5xx status codes and errors, as this can be very harmful to your website’s ranking as a whole.
HTTP 300 codes perhaps play the central role for SEO. This class of status codes is responsible for passing all the SEO value from your old URLs to new ones. Thus, it’s necessary to dig into each 300-level code’s meaning (temporary or permanent redirects, proxies, multiple choices, and so on).
HTTP status codes are for URL redirection. The 300-level codes indicate different types of HTTP redirects. Marketers usually use 3xx status codes to monitor and analyze user experience, the behavior of website users, and the SEO performance of the site. The DataTracker resource identifies four types of redirects distributed by 300-level HTTP status codes:
300-level status codes appear when it is necessary to indicate the redirection response from the server. Another example of the 3xx HTTP status code class in action is when the deleted page keeps its rankings. Additionally, redirects come in handy when it’s necessary to fix the broken URL.
For example, a 301 redirection was used via PHP to move all the traffic to a new page, https://eurovps.com:
<span><?php // Permanent 301 Redirect via PHP </span> <span>header("HTTP1.1 301 Moved Permanently"); </span> <span>header("Location: https://eurovps.com/"); </span>
This way, it preserves the ranking of the former URL. The same algorithm can be used for fixing broken URLs with the help of a permanent redirect.
Redirections don’t expect to see when errors related to other response codes take place. For example, redirects don’t solve problems with informational responses or server/client errors (Not Implemented = 501; Bad Gateway = 502; Unprocessable Entity = 420).
Let’s take a closer look at each 300-level code to understand their impact on SEO and website ranking. There are nine 3xx status codes to review, along with their peculiarities, functions, benefits, and differences.
These status codes are commonly used in REST APIs. Multiple choices are given to the browser that should pick sides with the resources that meet the request. For example, if you have multiple video format options or different file extensions to specify, a 300-level code will come in handy.
One more reason for using 300 redirects is to meet the requirements of agent-driven negotiations. The server informs a user-agent about available representation types to choose from. Take a closer look at the example to see the 300-redirect in action:
<span>HTTP/1.1 300 Multiple Choices </span><span>Server: curveball/0.3.1 </span><span>Access-Control-Allow-Headers: Content-Type,User-Agent </span><span>Access-Control-Allow-Origin: * </span><span>Link: </foo> rel="alternate" </span><span>Link: </bar> rel="alternate" </span><span>Content-Type: text/html </span><span>Location: /foo </span>
You can see /foo and /bar in the coding. The location is specified when both options are accessible for choosing.
One more status code is commonly used in REST APIs. The main idea is that the redirect is permanent. If you need to use redirection for a short time, the 301 redirect is not suitable for this purpose. Both internet users and search engines are taken to a new URL with the help of the 301 HTTP status code. The best redirection scenario of this type is when the former page is not planned to be restored.
Let’s explain the concept of permanent HTTP redirects with the help of a real case:
Let’s take a look at one more example of permanent redirection (301 redirect). Here we can see a 301 HTTP status code used to redirect users and search engines to the new location. Highlighted changes are in bold yellow.
Programmers often use a .htaccess file to implement different types of redirects, including a 301 redirect. There are two methods of 301 redirects to take into account:
<span><?php // Permanent 301 Redirect via PHP </span> <span>header("HTTP1.1 301 Moved Permanently"); </span> <span>header("Location: https://eurovps.com/"); </span>
<span>HTTP/1.1 300 Multiple Choices </span><span>Server: curveball/0.3.1 </span><span>Access-Control-Allow-Headers: Content-Type,User-Agent </span><span>Access-Control-Allow-Origin: * </span><span>Link: </foo> rel="alternate" </span><span>Link: </bar> rel="alternate" </span><span>Content-Type: text/html </span><span>Location: /foo </span>
It’s important to mention here that various coding approaches require different redirection implementations. For example, implementing 301 redirects using PHP will look like this:
Redirect 301 /[http://www.website.com/](http://www.website.com/)
Note that JavaScript is far from optimal for SEO practices. Google sometimes interprets 301 redirects in JavaScript incorrectly. If you’re interested in SEO-friendly permanent redirection, it’s better to select one of the methods listed above.
There’s one more commonly used status code in REST APIs. In comparison with permanent 301 redirects, 302-level ones are used when some temporary redirects are required. For example, you know about changes in this URL you’ll redirect soon, or the former page will be restored at some point in time. One more case is when you should delete the old page, but you need to redirect all the traffic and save ranking scores on the temporary URL. Among other reasons for using a 302 status code are:
It’s worth noting that implementation of 302 redirects can be undertaken the same way as for the 301-level. The recommendation to avoid JavaScript coding for SEO-friendliness purposes also applies here.
For example, in the image above we can see how the 302-level status code is used for the temporary relocation of the website. Note that you can also use this type of redirection for your website/page redesign, some testing, promotion running, and other short-term events and arrangements.
This HTTP status code allows a REST API to send suggestions to clients in the form of references. A notable feature of 303 redirects is their cache-free performance. But it’s worth mentioning that the second session of redirection will be cached.
A 303 status code doesn’t matter for SEO. Still, it can help improve user-friendliness and realize marketing purposes when another URL can be suggested instead of an already-visited one.
This code is commonly used in REST APIs as the other above-listed 3xx ones. When re-transmission is not needed, the unmodified status code can be used. It’s possible to make the redirect cache-free if the page has not been modified yet.
Let’s take a closer look at the coding with a 304 redirection example. The status code is specified under the requested method and URL.
This HTTP status code is deprecated for now. Some browsers don’t allow using this type of redirection. For example, Mozilla Firefox and Internet Explorer prevent users from 305 redirects for security reasons. The main explanation of this situation is the single proxy used to proceed with the request and provide access to the web resource. This approach is risky when it comes to some browsers.
Programmers don’t use this status code now. Its main idea was the opportunity to switch the proxy when some special-purpose request takes place. The user would return to the specified proxy by default if that type of redirection was presented in the coding.
This HTTP status code is very similar to the 302 status code. That’s why the method of implementation required for redirection is the same as for 301 and 302. Let’s dig into the difference between 207 and 302, since they both are about temporary HTTP redirects. Experts still debate this topic. For our purposes, there are two opinions to take into consideration about 307 redirects:
It means that any changes of the GET request method in 302 redirects lead to unpredictable results on the Web. It doesn’t happen with 307 redirects. Pictured below is an example of using 307-level temporary redirection.
This status code is considered experimental, but has the same semantics as a 301 permanent redirect. The only difference between 308 and 301 redirections is the availability of HTTP method changes. While 301 redirects allow user agents to modify used HTTP methods, the 308 status code implies unchangeable HTTP request methods for redirection.
The 308 HTTP status code is rather new, since it was introduced only in 2015. Some browsers still can’t recognize 308 redirects and show users empty pages instead of redirected ones (for example, Internet Explorer 11). That’s why 301 permanent redirects will be preferable because of better support and SEO-friendliness. The 308-level HTTP status code is still supported poorly, and search crawlers don’t always recognize it.
300-level redirects are important for preserving SEO value. If you need to move from one old page to another and don’t want to waste its ranking, temporary or permanent redirection is recommended. To save your link juice and not harm your website’s SEO when it comes to redesigning or other changes, you can use several HTTP 300 codes:
Redirects don’t harm search engine optimization but help avoid authority loss. It’s necessary to redirect pages the right way to save Google rankings and link juice.
When it comes to temporary and permanent redirects, 301 and 302 HTTP status codes are always prioritized. But there’s a difference between these HTTP 300 codes. Here’s the first scenario. You’ve decided to delete your old site forever. But this URL was often visited and highly ranked by search engines. There’s a recommendation to use a 301 permanent redirect to keep your link juice and Google rankings.
The second scenario is when you restructure your website and save your SERPs for some short-term period. The site will lose SEO value. Search engines will keep your old URL but start to index your new page after redirection. If you’re sure that all the updates and redesigns will come to an end and you’ll return to the old URL, it’s better to use 302 redirects (temporary).
If you misuse HTTP 300 codes, your search engine optimization might be affected by these mistakes. Here’s a shortlist of cases where SEO strategies fail because of incorrect redirects:
Note that the 301 status code will be suitable for topic clusters. If you really need permanent redirects, don’t use 302. Prevent the risk of losing rankings and traffic. The 302 redirects force search engines to keep indexing your old pages and stop them from transferring link juice to your new ones. Ensure you always check HTTP Status Code accuracy on your website by using dedicated software like WTOOLS and Redirect Checker.
301 has stronger canonization for Google. At the same time, the representative of Google’s team, John Mueller, stated that 308 and 301 HTTP status codes provide the same redirection and SEO-driven properties.
The 307 status code is preferable by SEO specialists. Because of the changing 302 syntaxes of redirects, it can cause any unexpected behavior. Additionally, thisRest API Tutorial states that 307 redirects come in handy when shifting client requests over to another host.
MOZ suggests 302 redirects if it’s essentially impossible to determine whether or not the search engines have identified a page as compatible. This way, any content that moves to another page temporarily should be redirected with the help of using the 302 HTTP status code. Crawlers will mention changes, and the URL will be indexed correctly.
To monitor how Google perceives HTTP status codes on your website, you need to undertake a website audit. There’s a range of special-purpose tools for undertaking on-site analytical research. Let’s take a closer look at the peculiarities of the analytical research process exemplified with the SEO website audit software.
SE Ranking offers a site audit report with issue descriptions and a how-to-fix guide for deep analysis of all critical website technical metrics, including crawling, security, usability, speed errors, and others. The software analyzes every single website page in detail, including redirection and the HyperText Transfer Protocol errors. Here’s the algorithm to get insights on your website HTTP status codes:
The infographics will contain the dominant HTTP status code class (1xx, 2xx, 3xx, 4xx, 5xx). Additionally, the number of redirects and detached pages will be specified in the report (under the main infographics).
During the complete website audit, SE Ranking detects weak spots and errors related to HTTP status codes, provides issue descriptions, and suggests how to fix them to improve your website’s online performance.
All of the HTTP 300 codes are worth the attention of modern business representatives who are interested in sound online visibility. For example, 300 (multiple choice) will be helpful for the performance of some marketing strategies where the user should select between several entities at once. The 303 (See Other) status code will come in handy when another URL should be used for redirecting to the resource of the interest.
But essential HTTP 300 codes are 301, 302, and 307, because they’re used for temporary and permanent redirects. These status codes are recommended for ensuring SEO-friendly website migrations, URL changing, site restructuring and updates, changing of domains, or shortly-republishing activities for website pages.
It’s worth noting that there are some requirements to the redirect process to meet Google’s ranking standards and not to lose link juice. There are main five tips to remember:
HTTP 3xx status codes are redirection responses. They indicate that further action needs to be taken by the client to fulfill the request. These codes are often used when a resource has moved to a different location.
What is the purpose of a 301 Moved Permanently status code?he 301 status code informs the client that the requested resource has been permanently moved to a new location. Subsequent requests should be made to the new URL.
How does a 302 Found status code differ from a 301 Moved Permanently?A 302 status code indicates a temporary redirection, and the client should continue to use the original URL for future requests. It’s different from 301, which implies a permanent move.
When should I use a 303 See Other status code?The 303 status code is used when a server wants the client to retrieve the response from a different URL using a GET request. It is often associated with the PRG (Post-Redirect-Get) pattern.
What’s the purpose of the 307 Temporary Redirect status code?Similar to 302, the 307 status code indicates a temporary redirection. However, it specifies that the client should use the same HTTP method for the subsequent request (e.g., if it was a POST request, use POST again).
Are there security considerations when dealing with HTTP 3xx codes?es, improper handling of redirections can lead to security vulnerabilities like open redirects. Developers should validate and sanitize redirection URLs to ensure they only redirect to trusted and expected locations.
The above is the detailed content of The Ultimate Guide to 3xx HTTP Status Codes. For more information, please follow other related articles on the PHP Chinese website!