Summer Promo Supporthost

Summer promo

35% discount until July 31 on all annual hosting plans (except dedicated services) using the coupon “july3524”

301 redirect: the definitive guide

Published in:


In this article, 301 redirect: the definitive guide, we will see what 301redirects are used for and find out why they are crucial for SEO.

Basically, 301 redirects allow you to redirect users from one page to another. The most obvious case where you may need them is when you change your site address, but that’s not the only instance where redirects are useful.

Let’s find out when they are needed and how to implement them, also by analyzing what happens when 301 redirects are not set up or are used incorrectly.

Let’s start from the beginning and see what 301 redirects are.

301 redirect: the definitive guide – what is 301 Redirect?

It is possible to use redirects within a site to get users from one page to another. A 301 redirect is a permanent redirection, meaning that it represents a resource or page that has been moved permanently.

Redirects are therefore a way to communicate to users and search engines that a page (or even an entire internet domain) has changed address.

For example www.mysite.it/products/ redirecting to www.mysite.it/products-list/

But why 301 redirects? This kind of redirect communicates a permanent shift to make a distinction between other types of redirects (such as redirect 302) that can be used, however, in the event that the shift occurs temporarily.

What changes between a temporary and a permanent move?

The user who is trying to visit that page does not perceive any difference. In both cases, he/she is simply redirected from one page to another and reaches the content he/she was looking for.

For search engine spiders this difference, instead, is fundamental. With a 301 redirect, we want to communicate to search engines that they don’t have to consider the old address anymore and that the content has been moved to a new address.

As we will see later when we look at redirect 301 and SEO, the use of this kind of redirects is fundamental to maintain the positioning.

When do you need a 301 redirect?

301 redirects can be used if you decide to make changes to your site structure, change domains, or even move some of your site resources. Let’s take a look at these different cases.

Site changes

One of the most common situations where you may need to implement a 301 redirect is if you change your domain. You could choose to change the domain if you want to change the extension from a .it domain to a .com domain.

Or you might find yourself at a turning point and decide to do a proper company rebranding with a new name.

In other cases, you might want to make changes to the structure of the site, for example moving part of the content from a subdomain to a subfolder. Moving from a structure:


to one like this


Or you could decide to move from the version without www to the one with www (or vice versa). In all these cases 301 redirects will allow you not to have problems with duplicate content and to direct users to the new version of the site.

Moving or deleting pages

301 redirects come to your aid not only when you decide to make changes that affect the entire domain, but also on a daily basis.

You may want to delete some content or pages of your site. In this case, the first question to ask yourself is why you are deleting that content.

Usually, you might want to delete blog posts or site pages to create new ones. In these cases, if you are going to create new content similar to what you want to delete, the best thing to do is to use a 301 redirect.

Redirect 301 Error 404

By doing this you don’t risk that the user trying to reach the content through the old address will end up on an error page. Typically an error 404 for content not found, if instead you set a 301 redirect the user who wants to reach that content will come directly to the updated content you created.

The same goes for search engine spiders. When the bots scan the pages and come to an error page they abandon the crawl. If, however, there is a redirect they land on the new page and are able to scan its content.

Switching from http to https

Currently, over 72% of websites use the https protocol. Those who switch from http to https must also set up a 301 redirect to direct visitors (and search engines) to the site with a secure connection.

Redirect 301 vs redirect 302

There are two most common types of redirects: the 301 redirect and the 302 redirect. As I mentioned before, these two types of redirects are considered differently by search engines.

In a nutshell, a 301 redirect is used for a permanent move, while a 302 redirect is used for the temporary move of a page. But what does this mean?

If search engines are faced with a 301 redirect they understand that the content has been moved permanently. This means that it no longer makes sense to index the old URLs, but that it is time to start indexing the new ones, i.e. the addresses that have been chosen as the destination of the redirect.

301 redirects vs JavaScript redirects

You can use JavaScript redirects as a last resort if, you have no way of accessing the site’s server. Remember that among the best practices ssuggested by Google, 301 redirects are always to be preferred and, unlike JavaScript redirects, 301 redirects allow you to transfer link juice to the destination pages.

Removing 301 redirects

301 redirects are permanent, but does that mean we have to keep them forever after we delete or move previous content?

A few years ago a response from John Mueller of Google clearly answered this question.

301 is permanent, it means forever and that’s a mighty long time, but I’m here to tell you, there’s something else: the server maintenance.
After a few years the old URLs are often no longer accessed & you can drop those redirects.

🍌 John 🍌 (@JohnMu) January 18, 2019

To avoid problems, the best solution is to maintain 301 redirects for at least a year. After this period it is probably better to make sure that you do not receive any more traffic from these addresses before you can remove them.

Redirect 301 and SEO

One of the factors that affect the positioning of a site is the PageRank. If in the past, using 301 redirects (or even 302 redirects) involved a small loss of PageRank (a loss that was around 15%), now it is no longer so.

We can find a confirmation in the FAQ dedicated to the switch from http to https, where Google assures that no PageRank penalty is applied by using redirects. This about-face in Google’s policies is largely due to encourage the adoption of secure connections with the https protocol.

301 Redirects Search Engines

At the same time, we must not forget how important the relevance of the content of pages subject to redirects is.

We have to keep in mind that Google doesn’t like redirects to home pages or to pages that don’t contain identical content (or at least similar) to the starting one. In these cases, if the 301 redirect is not considered valid or relevant, Google might consider it as a soft 404 error.

In order to keep the advantages in terms of SEO and not to lose positions, it is therefore important to pay attention to the destination links of our redirects.

Advantages and risks of 301 redirects

Let’s summarize the benefits of using this kind of permanent redirects and what to pay attention to in order to get the most out of your site.

301 redirects and users

301 redirects improve your credibility and allow users to reach your site.

Imagine that a user wants to visit your site, knowing the address already he/she types it in the address bar and expects to arrive at their destination.

In the meantime, however, your site has changed domain, let’s say that you have just moved from a .it domain to a .com or you have changed the name of your domain.

There are two possible scenarios.

In the first one, you have implemented 301redirects from the old domain to the new one: the visitor is redirected to the new site and everything goes as it should.

In the second one you haven’t used 301 redirects: the user is faced with a non-existent page, a 404 error warns him that that page doesn’t exist anymore. The result is that you lose traffic and in most cases, this also translates into a loss of revenue.

301 redirects and search engines

301 redirects let search engines know that you’ve moved content around.

Let’s consider a case similar to the previous one: you have changed the domain and now your content is on a new site.

In this case, however, let’s analyze what happens from the point of view of search engines.

301 Redirect Website Authority

If you don’t use redirects, search engines will continue to show the old URLs with which you are positioned. Gradually though those pages will start to lose positions because they don’t really exist anymore and lead to 404 errors.

Search engines aim to lead users to what they are looking for and not to error pages. If you don’t redirect old content to new content you will invariably lose all the work required to position yourself.

On the contrary, with 301 redirects the page authority of the old addresses is transmitted to the new ones.

Redirect 301 and duplicate content

With 301 redirects you eliminate the problem of duplicate content.

As a site expands it can sometimes happen to see the accumulation of similar content, different pages with similar information or posts from your blog. If two pages are considered duplicate content, Google will choose only one version to show in the search results.

If you have pages that are very similar to each other consider funneling the content into one page and thus create a more complete resource. After merging the content into only one of the two pages delete the other. At this point use, a 301 redirect to redirect traffic from the deleted page to the full page.

This method also helps you eliminate keyword cannibalization issues. If two pages on your site are trying to rank for the same keyword combining the two pages can help you create more complete content that performs better in terms of traffic.

Redirects are a double-edged sword.

You have to consider that redirects are useful, but that sometimes they could be exploited even by those who do not have good intentions. It is likely that your site has links to resources on other domains and what if those resources were moved?

In the best-case scenario, if you link to a page or a site that no longer exists, users will find themselves in front of a non-existent page. But what if they are on a completely different site?

When a domain expires it becomes available for registration again. This means that potentially anyone can register it and use it to create their own site. This prompts some people to register expired domains to grab backlinks and thus attract traffic to the site.

It’s a good idea to monitor links pointing to other domains to make sure there are no redirects pointing to content other than what you wanted to direct your users to.

Chains of redirects

Be careful of redirect chains.

If a page links to a series of redirects, before reaching the destination page, you create what is called a chain of redirects.

The reason is that over the years, migrations and changes in site structure can occur. The problem is that these chains sometimes become an endless loop that prevents users (and search engines) from reaching the landing page.

In this case to break the redirect chains you just need to remove the oldest redirects and thus shorten the chain.

If you don’t do this, you risk that the response time to reach the destination page will be too long and the browser will return an err_too_many_redirects error without being able to reach the page.

To check that there are not too many redirects there are several tools we can use.

Detect redirect chains

The online tool httpstatus allows us to enter addresses (up to 100 URLs at once) and check for redirect chains.

Redirect 301 Chains Of Redirect

SEO Spider by Screaming Frog (also in the free version) can be used to detect redirect chains. Remember, though, that in the free version you can scan up to a maximum of 500 URLs at once.

After completing the scan we will have all our site pages with their http status code (200, 301, etc). If we click on the menu at the top Reports Redirects Redirect Chains we can download a csv file with the chains of redirects detected.

Screaming Frog Redirects Report

In this way, we can easily identify the chains and the number of redirects there are between an address and the destination.

Screaming Frog Redirect 301 Report

Redirect and sitemap

Do not include pages with redirects in the sitemap.

Before submitting the sitemap of the site to the search engines you must make sure that the pages have a 200 http status code, i.e. that there are no errors.

This is also valid for redirects, a good rule is to make sure to remove from the sitemap the pages with 301 status code, that is those that are redirected to other pages.

On the other hand, if the sitemap already contains the new URL to which the page redirects, it doesn’t make sense to ask the bots to scan also the pages that redirect to others already present in the sitemap.

How to implement redirect 301

There are different methods to implement a 301 redirect. The most commonly used method is to insert a rule in the .htaccess file of the site.

This method is only valid on Apache servers.

To edit the .htaccess file you can access the root of the site from an FTP client (like Filezilla) or use the cPanel file manager.

The code you have to insert depends on the kind of 301 redirect you have to do: moving a single page, redirecting from the old domain to the new one, switching from http to https are some of the most common examples. Let’s see how to do it from one case to another.

I remind you that before modifying the .htaccess file is always good to create a backup copy so you can restore it in case of errors.

How to make a 301 redirect of a page

If you want to redirect a single page to another you just need to insert this line in the .htaccess file:

Redirect 301 /old-post https://www.miosito.it/new-post 

Going to replace the old and new addresses respectively.

The code must be inserted after <IfModule mod_rewrite.c> and before </IfModule>.

Do a redirect from the old to the new domain

Insert this code in the .htaccess file of the old site when you change domain and want to redirect to the new site.

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^old-domain.com$ [OR]
 RewriteCond %{HTTP_HOST} ^www.old-domain.com$
 RewriteRule (.*)$ https://www.newdomain.com/$1 [R=301,L] 

In this case, you will have to replace the addresses with the ones corresponding to your old and new sites.

Redirect da dominio www a non www o viceversa

Anche se il tuo sito è accessibile da entrambe le versioni (con www e senza) è meglio stabilire una delle due come versione predefinita.

Per questo potresti dover impostare un redirect 301 dalla versione con www a quella senza o viceversa.

Redirect from non-www to www

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^website.com [NC]
 RewriteRule ^(.*)$ http://www.website.com/$1 [R=301,L] 

Redirect from www to non-www

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^www.website.com [NC]
 RewriteRule ^(.*)$ http://website.com/$1 [R=301,L] 

Redirect from http to https

 RewriteCond %{HTTPS} off
 RewriteRule (.*)$ https://www.website.it/$1 [R=301,L] 

Always insert immediately after RewriteEngine On.

Redirect 301 with PHP

You can set a permanent redirect using PHP header function, like this:

header('HTTP/1.1 301 Moved Permanently'); 
header('Location: https://www.new-website.com');

You will have to insert the new address instead of www.sitonuovo.com. Alternatively, you can also use a single code line, remembering to specify the 301 status code, since this is a permanent redirect:

header('Location: http://www.new-website.com', true, 301);

Redirect with cPanel

In addition to editing the .htaccess file, you can also do a 301 redirect with cPanel. cPanel is one of the most widely used hosting management panels and is the one we provide to users who choose one of our plans from WordPress hosting to VPS cloud hosting and dedicated servers.

Adding a redirect with cPanel will automatically create a rule in the .htaccess file.

To add a redirect we simply log in to cPanel and scroll down to the Domains section and click on Redirects.

Cpanel Redirect 301

From this point, we choose the type of redirect (301 permanent or 302 temporary). We select the domain we want to redirect.

If we want to redirect a single page, we just complete the path by entering it in the / field as you see shown here:

Cpanel Add Redirect 301

We then enter the destination URL in Redirect to and finally click on Add.

Be careful because in this case the redirect rule is added at the end of the .htaccess file. If you are using WordPress or another CMS this rule might get ignored and the redirect will not work.

After creating a redirect with cPanel you will not be able to edit it. If you want to make changes you will have to delete the previous redirect and create a new one.

To delete a redirect, simply go to Domains Redirects and scroll down the page until you locate the redirects you have set up. After that click on Delete from the Action menu.

Cpanel Delete Redirect 301

Redirect 301 with WordPress

To make a redirect with WordPress you can use a plugin e semplificarti la vita.

Set up redirects with the Redirection plugin

Redirection is a free plugin designed specifically to simplify redirects on your WordPress site. First, let’s install and activate the plugin.

Login to WordPress and click on Plugins Add New. Let’s look for the plugin we are interested in, install and activate it.

Install Redirections Plugin

By starting the configuration we are asked if we want to track changes to permalinks and if we want to record a log of redirects and 404 errors.

Redirection Configuration

Let’s complete the configuration and we are ready to use the plugin.

In the Tools section of WordPress, you will now see a new entry: Redirection.

Tools Redirection

From this section, we can set the redirections by simply entering the old URL in the source URL field and the new one in the target URL as you see in this example.

Redirection Plugin Add Redirect 301

By clicking on the little gear icon next to the Add a redirect button, we can set the type of redirect. If you want to set a permanent redirect just choose the 301 option.

Redirect 301 With Redirection

After checking that the addresses are correct click on Add a redirect to add the redirect.

The redirects added will be visible in the box at the top which will also allow you to see the number of visits to the page. This way you can get an idea of how much traffic you are getting from the old URLs.

Redirection Plugin Redirect 301

Set up redirects with Rank Math SEO

If you are using Rank Math SEO as a plugin to get tricks for optimizing your articles, I have great news for you. This plugin also integrates a feature to easily manage redirects. Let’s see how it works.

First, if you haven’t already done so, install and activate the plugin.

Install Rank Math

After activating it follow the wizard and you are ready to use Rank Math SEO. Let’s see what options it gives us for managing redirects.

Set redirects

Let’s make sure that the Redirections module is active from the plugin’s bulletin board to the Modules section.

Rank Math Seo Redirect 301

After activating it the Redirections option will appear in the side menu (Rank Math Redirections).

Rank Math Redirection

To add a new redirection we just need to click on the Add new button that we see at the top.

Rank Math Add New Redirect 301

We can then redirect one page of the site to another simply by filling in the following fields:

Rank Math Add Redirect 301

Source URLs: here you have to insert the source URL (the old article or the old page).

Destination URL: here you have to insert the destination address.

Redirection Type: we can choose between 301 redirect (permanent) or temporary redirect (302 or 307).

In the end, we click on Add Redirection.

In most cases, we won’t have to change any options. If, on the other hand, we want to redirect several pages to one destination we can do it without having to set the redirects one by one.

By clicking on the Add another button in the Source URLs field we can add other fields in which to insert the other addresses.

Rank Math Multiple Redirections

Also, when we delete an article, a page or even an element of the taxonomy (tag or category) Rank Math reminds us that we can set a redirect with a warning like this:

Rank Math Redirect 301 Seo Notice

By clicking on the a new URL we can set the destination address and choose the type of redirect.

Match types

Next to the field where we go to enter the source address (Source URLs) we also see a drop-down menu that by default is on Exact.

Rank Math Select Redirect 301 Type

This is the type of match that the redirect will be valid for. Usually, the redirects we want to set up are an exact match.

This happens when we want users visiting the www.mysite.it/old-article page to arrive at the www.mysite.it/new-article page. In this case, users will only be redirected to the new page if they type in the full address we set as the source.

Rank Math also allows us to redirect all URLs that contain a certain string. In this case, we’ll just specify in the Source URL field the text string (and not the full address) and then choose from the dropdown menu Contains in this way:

Rank Math Add New Redirect

In this case, all URLs that contain that word anywhere in the address will be redirected. For example:




By choosing Start With as match type we can choose to redirect URLs that start with a specific word. In this case, only addresses that have the specified word at the beginning of the URL will be redirected.

In the example above, mysite.com/tutorial-rank-math would be redirected while mysite.com/rank-math-tutorial and mysite.com/guide-tutorial-wordpress would not.

In the same way, by choosing End With as a match type we can redirect all URLs ending with a certain word.

In our example, only mysite.com/rank-math-tutorial will get a match and will be redirected.

Manage site redirects

Clicking on Rank Math Redirections we can have an overview of all the redirections we have set on the site.

The From column shows us the starting URLs, the To column the destination addresses. In Type, we can see the type of redirection.

Rank Math Redirection List

The Hits value shows us the number of times the old link has been visited, while in Last Accessed we see the date of the last access to that address.

From this screen, we can also edit, disable or delete redirects.


In this article: 301 redirect: the definitive guide, we’ve seen what 301 redirects are for and their relevance for users visiting your site and for search engines. There are a variety of situations where you need to set up a redirect and also different ways to do it. We have seen how to do it by putting a rule in the .htaccess file and how to make things easier and manage redirects directly with WordPress.

Have you ever found yourself using 301 redirects? What method did you use to implement them? Let me know in the comments below.

Try one of our hosting plans for free and without obligation for 14 days. No payment information required!


Leave a Reply

Your email address will not be published. Required fields are marked *