Why to Use Redirects and What Are Their Types?
Changes in the structures of URLs, errors resulting from deleting subpages and duplicate content because of the same texts published at different addresses, for example after implementing SSL, can negatively affect how the search engine assess the website. But above all else, hindered access to content discourages users. That’s why it’s worth using redirects in order to make browsing the website easier.
The user-friendly navigation and URLs on the site entice customers to visit your website once again. As robots try to “think” like humans, these factors will also positively influence how the search engine perceives your site. However, it’s beyond the bounds of possibility to prevent your content from evolving – the assortment of the store is constantly changing and the default addresses created by the CMS usually leave much to be desired when it comes to convenience. This applies primarily to the e-commerce industry, but even administrators of small blogs need to remember about making their content easily accessible. Redirects are one of the methods of organizing content.
CMS migrations are another challenge for shop owners. New menu, a different style of constructing URLs or maybe even changes in the category tree – all of these will make the links to the old version of the site start generating HTTP 404 error pages. Here, again, redirects turn out to be very helpful. Keep reading our article and you’ll find out how to properly use redirects. Now it’s time to introduce the possible solutions.
Redirects – what are they?
Generally speaking, a redirect can be described as an HTTP response with instruction of redirecting to another landing page. It informs your search engine and robots that the content they’re looking for has been relocated either temporarily or permanently.
When it comes to the user’s point of view, they see it simply as being redirected to an address different from that assigned to the clicked link. This is a particularly convenient solution as without redirects, error pages would be displayed to the users and they would have to search for the needed content or products on their own. In a situation when there are plenty of subpages on a given website, the task isn’t the easiest one, therefore, users often resign and decide to leave the page. And redirects are the solution that helps to prevent it.
Types of redirects
Different status codes are provided depending on whether the activities on your website are only temporary or whether the content is permanently relocated or deleted. Although the end users always get to the needed subpages regardless of their codes, these codes are essential for search engine robots.
301 redirect – the permanent one
A “301 Moved Permanently” redirect is a very common and widely recommended one. It informs that the content has been permanently relocated to another subpage and will never be available at a given URL again. For robots it’s a clear instruction that instead of visiting this URL, they should follow the message contained in the redirect. Additionally, after some time, the existing website address may be removed from the search engine as it doesn’t provide any relevant content.
302 redirect – the temporary one
A 302 constitutes another popular type – it’s often set by default and it’s the temporary one. It’s represented by “302 found message”, therefore the information for search engine robots is less specific here. The required content cannot be found at a given address but it’s accessible somewhere else. After some time the content may be available at the existing URL again so contrary to 301 redirects, the robots will be revisiting the original address to check if the content has been restored.
Other types
Apart from the commonly known 301 and 302 redirects, there are several various HTTP status codes whose function is to redirect users or robots to different addresses.
- 303 redirect – See Other – should be used only with forms that send data using the HTTP POST method. In response to the form, the process of redirecting to a specific address starts without resending information via POST.
- 304 redirect – Not Modified – content hasn’t changed with respect to what users know. This type of redirects informs the search engine that the stored data is still valid. It’s possible to display the content to the users, there is no need to download it from the source.
- 305 redirect – Use Proxy – access to a given site will only be possible with the use of a specific proxy server. Of course, the message includes the address of the server that should be used by the browser.
- 307 redirect – Temporary Redirect – a temporary redirect to another URL address. The only difference from 302 – Found is that its query method doesn’t change. Frequently used 302 can be interpreted as 303 (change of POST to GET) or 307 depending on the circumstances.
Incorrect redirect settings may lead to error 310 – too many redirects. It informs about a redirect loop problem which makes it impossible to access the address specified in the instructions.
SEO and the importance of redirects
We’ve already mentioned that from the user’s point of view, redirects make browsing the website much more convenient. Proper configuration of server status codes is at the same time a powerful weapon in the fight to maintain high positions in the search results. The aim of SEO is to provide the robots with clear information about the content of the site and redirects are one of the methods of influencing their work.
A “301 Moved Permanently” redirect enables you to pass the vast majority of the link equity to a new address. However, due to security updates in Google algorithms that protect the search engine from manipulation, the value of the link will never be completely passed.
On the other hand, 302 redirects don’t pass any value of the link but only direct traffic to a new address. The old URL will still be displayed in the search results, which is beneficial in case of any temporary changes such as a break from publishing promotional content or reconstruction of the subpage. However, the ultimate decision is always made by the search engine – it’s possible that a 302 redirect will be interpreted as a 301 and the original URL will be deindexed.
When to use redirects?
The theory provided may turn out to be insufficient, that’s why we’ll give you some real-life SEO examples when the right instructions for search engine robots are crucial. If redirects aren’t used in the situations described below, the website may lose valuable traffic or the same subpages with different URLs will be considered as duplicate content and will be ranked lower in the search results.
Forcing the use of a particular version of the website
Depending on the server configuration, the website content may be accessed at the address with both the “www.” module and without it. If both versions generate the 200 OK code, then they can be interpreted as duplicate content of the same site. To avoid such a situation, it’s advisable to set a global 301 redirect which will lead to one selected address variant. To do this, use the .htaccess file available on the server. A redirection command may look as follows:
RewriteCond %{HTTP_HOST} ^www\.myaddress\.com [NC]
RewriteRule ^(.*)$ http://myaddress.com/$1 [L,R=301]
Use of SSL protocol
Implementation of SSL protocol brings many benefits. Apart from providing better security it also positively affects how search engines perceive the site. However, in order not to cause additional problems with duplicate content accessible through HTTP and HTTPS, it’s worth making the browsers use the more secure version. It’s a good solution to use the .htaccess file and set a global 301 redirect to URL starting from https://.
Below you can see an example of a command that at the same time serves as a redirect to the address version without the “www.” module and as a HTTPS protocol.
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
When creating this type of redirects in the .htaccess file, it’s always worth checking the documentation provided by hosting which often includes instructions on how to configure redirects. The above examples won’t always be suitable.
Domain change
If you decide to change the address of your website, make sure you exactly copy the content from the original site to the new one. On each subpage of the old version, set the 301 redirect with the URL of the new corresponding subpage. Thanks to it, users that found a link to the site on the old domain will still have access to the content they’ve been searching for. On the other end of the spectrum, search engine robots will get precise information about where to look for the relocated content. Lack of appropriate redirects will mean that you’ll have to build traffic to the new website completely from scratch.
Creating a new URL structure
Our article “URL Structure” provides readers with a recipe for creating user-friendly links which greatly influence both the UX and SEO of a website. However, lack of 301 redirects from the old to the new version of the site can ruin your efforts. The same applies when you decide to change the structure of the category tree in your store. In both cases, the links in the page menu will usually change automatically but external links or manually created links such as the ones in the posts on the blog will still contain the old address. And as we’ve already mentioned, the HTTP 404 discourages both users and search engine robots.
CMS migrations
The decision to change the CMS of a store may be caused by many factors such as expansion of the assortment exceeding software capabilities, willingness to integrate with other (not supported) services or simply comfort of use – these are just a few examples. Regardless of its reason, CMS migration entails irreversible loss of the existing URL structure. Therefore, it’s necessary to use 301 redirects between the old and new version of the CMS. Unless you provide it, most of the clicks on the search results supposed to redirect users to your website will generate the HTTP 404.
Subpages of unavailable products
If a product has been withdrawn from the offer, one of the possible solutions is to use the 301 redirect to show customers similar goods (for example different versions) or categories in which they’ll be able to find something satisfying to replace the unavailable product. It’ll also enable you to pass most of the value of the non-existent subpage.
However, it needs to be noted that in this particular case hiding the product page may not be profitable. To learn more, go to our previous article https://delante.co/product-unavailable-how-to-deal-with-it/
Learn more about your CMS
Apart from the knowledge of the redirect types and their exemplary applications, you should know how to create them in CMS. The latest versions of properly configured systems such as WooCommerce or Sote, use 301 redirects automatically when changing the URL of subpages. However, it often happens (also in older versions of the abovementioned CMSes) that you have to manually set up redirects with your menu options. There are still content management systems that don’t support redirects and you need to set everything using FTP access.
If you want to create a friendly product or category URL that will replace the current default address, be careful and follow the instructions:
- Keep the old address so that you can test how the redirect works.
- Check if the potential new address is available – entering an already existing URL as a new one may result in a redirect loop problem, logging out from the admin panel and blocking the further use of the website. In this situation, only FTP will be able to save you.
- Enter the new URL address if you are certain it can be used and check if the redirect has been automatically created.
- If the redirect hasn’t been created automatically (or you know that your CMS doesn’t have this function), in the software settings find the option to manually set up the redirects.
- If this option is not available, use the .htaccess file on the server.
- Index both addresses in Google Search Console.
Automatic redirects often work properly only the first time the URL is changed. Each subsequent change of address requires the use of the manual setting option, as the system isn’t able to correctly redirect traffic from two (or more) previous versions of the website to the new one. The abovementioned Shoper is a perfect example, thus it’s worth checking how this function operates.
Redirect or maybe rel=canonical?
Proper implementation of redirects isn’t always possible. It often results from the specificity of CMS which doesn’t provide such a functionality or creates addresses responsive to the way the user got to a given subpage. A product that falls into several categories within a single website is a good example to discuss because different links can redirect you to it:
- https://shop.com/category/product
- https://shop.com/specific-category/product
- https://shop.com/procuder-name/product
Creating redirects in such a situation will be difficult (not all the variants are always known) and risky, because it can easily generate errors. On the other hand, canonical URLs will prevent search engine robots from seeing different variants of the same address as duplicate content. This is a safer option that will also have a positive impact on SEO of the site. However, you should remember that canonicals are just a suggestion for Google and they can be ignored. For more information, go to our article on rel=canonical (https://delante.co/rel-canonical-what-are-canonical-urls-for/). In many places, specialists prefer to use canonical URLs instead of 301 redirects.
The take-home message
Proper configuration of redirects on your website allows you to manage traffic and pass as much value of the deleted subpages as possible. Therefore, it positively influences both the UX and SEO of the website. However, remember to be careful while creating redirects. In the best-case scenario, the users or robots will only be redirected to the wrong subpage. If the worst comes to the worst, it won’t be possible to use the site anymore.