A 301 redirect can be compared to a change of postal address. Page A and its content are moved to page B. This way, the traffic and popularity of page A is transferred to page B, which may also belong to a new domain name. "301" refers to the HTTP code for this type of redirection. We will see later that there is another redirection code. But in most cases, the 301 redirect remains the most effective and durable method.
This redirection is definitive and transparent for the Internet user. Although it can generally be "cut off" to return to page A, it is advisable to think carefully before implementing it. Google's robots do not like weathervanes!
You can use 301 redirects to modify the structure of your site or your urls (as in the case of rewriting a url) while making sure not to affect the position of your pages. It is also essential when changing a domain name.
The 301 can be used for both on-site and off-site optimization:
- Modify the structure of your site and manage your pages’ life cycle
A site is never static. Like store shelves, categories, subcategories and product pages are bound to be renamed, moved or deleted. This type of change is usually handled by 301's. In order to remain consistent for Googlebot, the new page must be very close to the old one. Otherwise, the bots would not understand why it is not a separate page and could suspect an attempt to manipulate the algorithms.
Despite all your good will, it can happen that some of your pages are too similar. Duplicated content is in Google's sights, so you must find imaginative ways to limit it as much as possible. Setting up the redirection of a url to its "look-alike" can be a good way to prevent a penalty from Panda!
The 301 can be useful to recover poorly written URLs from anchors and external sites (which link to a 404 error page) but whose SEO benefits are important.
The change of domain name
A website evolves at the pace of the company that owns it. Sometimes, a change of the domain name (also called DNS, for Domain Name System) may be necessary in the case of a change of brand name or extension (.fr => .com).
For showcase sites with few pages, it is a relatively simple transition to make. For e-commerce sites, it can be a real challenge that must be well prepared to avoid negative SEO impacts.
The site is accessible from several urls
Several URLs are used to access your site. Just select one URL as canonical (original content) and use a 301 redirect to send traffic to the new / improved URL.
HTTP to HTTPS migration
HTTPS, or "secure HTTP", was developed to secure transactions. The HTTPS protocol is essentially the same as HTTP, except that it uses an additional layer of security because it moves data via SSL. In short, HTTPS is the secure version of HTTP.
In August 2014, Google officially announced that switching a site to HTTPS would mean an SEO boost. Today, it is an official criterion that has become essential for a site's ranking. This is why many sites have had to invest time and money in migrating their site to HTTPS.
At first glance, one may think that it is simply a change of protocol, by simply adding an "s"! Unfortunately, it is much more complicated. This change requires the implementation of 301 redirects “en masse”, to transfer all pages in HTTP to HTTPS. Faced with the magnitude of the task, neophytes are often tempted to say "too bad we leave in HTTP". This is a big mistake because the gains are considerable. Let's not forget that Chrome (which belongs to Google) now blocks HTTP sites by displaying a security alert that users must accept to access a site.
WWW or not: manage redirections between versions
How to make sure that all unused versions of URLs redirect to the right one?
Domain structure: WWW subdomain
The use of www is optional (it is basically no different from an SEO point of view to use www.mondomaine.com or mydomain.com). However, it is absolutely crucial that redirects from the "unused" version to the active version are set up. Thus, if a site has chosen to use URLs without www, https://www.domain.com/folder1/page1 must redirect in 301 to https://domain.com/folder1/page1, and this in a transparent way, in order to capture all the SEO traffic. And vice versa.
They must be 301 redirects (not 302 for example).
How to check it yourself:
- Directly on the browser: by typing the unused URL, to check that you are redirected to the active URL.
- By using tools or extensions, like "redirect path" which allow you to see all 301 redirects.
Do not hesitate to check also by taking into account the versions in HTTP, HTTPS, the ".com", ".fr", etc., or any additional version available.
Let's suppose that your site is "https://monsite.com" here are the combinations you need to look for:
Obsolete pages within the same domain
This problem affects showcase sites and mainly e-commerce sites, which must create a page for a specific product and associated dynamic category pages. Sometimes, the characteristics of the product or service change and require the creation of a new URL.
Let's take an example of the most frequently encountered case:
On his car site, a merchant sells an exhaust specific to car Clio 4. He has a page http://carparts.fr/exhaust-clio4-ref5286.html. For various reasons, his supplier stops the production of this exhaust. The merchant will then turn to another supplier from whom he can buy the same exhaust but from a different brand. He can't use his old product page, whose URL includes the reference of the old brand. However, this page is well positioned and generates traffic. It would be a shame to delete it. In this case, some e-merchants opt for the implementation of a popup inviting users to consult another similar product. But this requires an action from the user and as we know, the user is lazy and in a hurry. He can therefore leave the page immediately, thus increasing the bounce rate of the page, which is also an SEO criterion. In this case, permanent redirection is a good idea. The new page benefits from all the power of the old one and the user accesses the product page he is looking for. In this case, the 301 improves the user experience and preserves the page's SEO. Of course, large e-commerce sites cannot work page by page. There are dynamic solutions to manage these redirections.
Backorder and expired domain strategy
This is a rather particular use of the permanent redirection. It is totally independent from the site. The backorder consists in pre-booking domain names that are about to expire via specialized sites such as Youdot or Domstocks. Once purchased, these are fed with content, their Trustflow is improved and then redirects to the merchant site are set up. This is like sending good "SEO juice" to your site, which you would have squeezed yourself. Some netlinking specialists use this method as part of a PBN (private blogging network). Today, this kind of redirection is no longer unanimously accepted by SEOs who see less and less effectiveness and fear that Google will soon detect them.
Special case for e-merchants: management of expired products
You have products that are no longer in stock or expired and you want to remove the product page from the site without affecting your SEO?
A 301 redirect allows you to replace an old page. It is particularly suitable for a product that will no longer be available on your online store. This will allow the search engine to replace the old page on its index and pass the juice to the new one.
- If no substitute product exists in your catalog, redirect your deleted product to the top category.
- If you have a similar product in the category, redirect in 301 the URL of the deleted product to the page of a similar product. Be careful that this is not disappointing for the user, the choice of the alternative product must be relevant!
- If you cannot keep the old URL (very precise URL no longer adapted to the substitute product) you can also create a new page and set up a 301 redirection from the old URL to the new URL.
There are several methods to set up a permanent redirection. Some website managers (CMS) like Prestashop provide modules to make 301 in a simple and intuitive way. But in some cases like domain migration, the manipulations are more complex and require some technical skills.
Redirecting a url using .htaccess
First of all, you need to make sure you have access to your server and to your Apache configuration file. The modification of the .htaccess file is done with a command called "Allow Override" in the Apache configuration file. If you don't have this access, you must ask your web host.
Once the access is opened, you must locate the .htaccess file. This file controls the directories and subdirectories that it contains. In most cases, it is located in the root web folder of your site. If no .htaccess file is present, you must create it. Then open your FTP, with a software like Filezilla, then take the path in the root folder to access the .htaccess.
NB: The dot in .htaccess is used to hide it. You must therefore make sure that the FTP browser is activated.
It is recommended to use a text editor like Unix to edit the file. To redirect a URL or a domain, you just have to indicate it to the server by adding a line. For example :
Redirect from one page to another:
RedirectPermanent /old-file.html http://www.domaine.com/nouvelle-page.html
For 301 Redirect a whole domain :
RedirectPermanent / http://www.nouveau-domaine.com/
Redirecting a PHP page
It is generally advised to use the .htaccess to perform redirections (simpler and less risky). But when this is not possible, there is the redirection of the page in PHP. It is a piece of code to integrate before any other type of content. This means that no character or space must be sent before the call of the header function.
To permanently redirect a page via PHP, place this code at the top of the page
This code can be compressed to a single line like this:
Whether you opt for .htaccess or a PHP redirect, it is imperative to take some precautions, such as keeping a copy of the .htaccess file before it is modified. Then you have to check that the redirections are working properly and that the pages are only redirected once to the right page. Finally, you must make sure that only one redirection method has been used in order to avoid .htaccess / PHP conflicts.
Be careful not to keep these URLs linked in the site. Even if the redirection does its job of redirecting from page A to page B, if page A remains accessible within the site, the internal linking (internal links) slows down and decreases the overall SEO performance of the site.
Verification: During an audit, a crawler is used to locate all the URLs present in the links of the site, and redirected. We recover a list with each time, the source URL (page A) and the destination URL (page B) of the redirection.
Bug fixing: We must retrieve the incoming links of these source URLs (also called "inlinks") to know which page(s) link to page A, then we modify all these links to point directly to page B. These inlinks are available via the crawler, and as part of an audit with Smartkeyword, they are provided to you.
-> Result, the page A, not useful because redirected, is no longer present in the site and the internal mesh much more fluid!
Depending on the number of URLs concerned, this action can potentially have a very significant impact on the SEO performance of the site.
If it is the same use case, the same type of page, then you must implement a permanent solution for a problem that seems to be recurring. For example, if you have a list of several category or product pages that have expired: you must then review the management of this case so that, once the cleanup is done, it will not happen again in the future.
Be careful to look at some special cases: sometimes 302s are used to redirect temporarily (a product out of stock but that comes back in 1 month). In this case, you should not do anything, as you may have to revert back to the way it was before.
302 redirections should be used sparingly: only when it is really a temporary operation, but never for a redirection that is actually definitive.
If during a check via a crawler, you find a lot of unsuitable 302s: you should change them to 301
These cases are rather rare and there are several codes with their own usage. We will not go into detail here.
If the audit (or exploration by a crawler) highlights these codes, do not hesitate to contact your technical team to find out the cause, and in any case remove them from the internal mesh, as explained for error 1 on redirections above.
Unlike a 301 redirect, the 302 is temporary. It tells the robots that the "move" is not permanent, which does not make their task easier. They have to determine whether the old page should be kept or replaced and if so, for how long. And as we said at the beginning of the article, Google does not like changes and confusing situations. Specifically, there are not many situations where 302 redirection is appropriate:
- A/B testing a web page for functionality or design.
- Updating a web page while preserving the user experience (UX).
302 redirects should therefore be used when webmasters need to evaluate performance or gather user feedback.
Google claims that many sites mistakenly use 302, which is faster to set up than 301. Whether Google handles 302s as well as it claims is an open question. Are search engines still indexing the old page while ignoring the new one? Is the popularity of the links split between the 2 URLs and thus divided by 2?
If Google claims that its robots know how to manage 302s, it would still be a shame to risk losing the positions of your pages because of a simple confusion.
The 301 redirection is a common technique that must be used with care to maintain the popularity of your pages. If it is often indispensable, it should be remembered that a good management of a site’s structure and faceted navigation allows to limit the use of redirection for on-site optimization.