Redirection 301, definitive guide –

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

If you have a website, you are going to have to work at some point in the project, the 301 redirect.

The 301 redirection is an action that you should definitely take if you want to improve the SEO of your website and the usability within your page.

There is nothing worse than finding yourself browsing a web with a page that does not exist. To solve this common problem there is the 301 redirect.

During the article you will see what it is, types, when to do it, how to do it and why it is so important for web positioning.

Go for it.

What is a 301 redirect?

A 301 redirect is an action to be taken on a url that has ceased to exist.

It basically consists of making when someone enters a nonexistent urlautomatically this user go to another that we have adapted as destination link.

A 301 redirect is considered as permanent in such a way that we are indicating that the old url no longer exists for some reason and that the valid one is the one that we have now created.

Speaking in simple terms, a 301 redirect tells the browser: “This page has been permanently moved and this is the new location.”

To which the browser replies: “ok, I’ll send the user to the new url without problem!”.

For example, if you apply a 301 redirect to the url yoursite.com/example-1 indicating that it points to the url yoursite.com/example-2, when a user or search engine robots access the example-1 they will be redirected to the example -two.

Using redirections on a website is the most common and it is something that we have to do for several simple motifs:

  • You may have deleted or modified a url.
  • The url is not very friendly and you have realized later that it is not the right one and you change it.
  • You want that when someone clicks on a url that is a guide created in a certain year, they go to a new one created today.

There are many simple reasons why you might want to take the action of performing a 301 redirect, but there are others. most complex moments to carry out this work such as:

  • Your website has the .com extension but you have also bought the .es and you want whoever accesses the .es in the browser to send the .com.
  • You have moved your website to a new domain and you want anyone accessing the old one to redirect to the new one.
  • You need that when someone accesses your website with the www, they redirect to the web without it, which is the one defined. Likewise without http to https.
  • You have merged the content of 2 websites into one site and you want both to point to the new domain.
    Not only can redirections be made in general between domains or subdomains, but also directories, for example, or from http to https.
See also  logos and trademarks with images on our website

As you can see, it is essential to carry out these actions because they will make all the urls intertwined, preventing both Google and the user from finding a non-existent page ().

In addition to facing SEO having a good system of redirections is necessary to climb positions and improve the strategy.

Difference between 301 and 302

The 301 and 302 redirects are a way of telling search engines that the URL of a web page has changed permanently or temporarily.

Let’s see in more detail the difference between the two

The 301 Redirect

Every time you enter the code 301 we are before a permanent type redirect which is used when the URL of a page has been changed with the intention of making it forever.

When a 301 redirect is done can you remove the old urla (the one that we have changed or eliminated) by accessing Google Search console, section >Deletion of urls.

We have to tell google that url A no longer existsthat we do not want it and that the url B is the good one.

Eliminating A for 6 months (removal period given by Google Search Console) and redirecting to B we send this order to the robots.

After that time approximately, Google must understand the redirection, I can even eliminate that order.

Note that the use of the 301 implies transfer the strength of the old urls to the new onewhen making them, all the force is transferred to the new address.

Also note that an excessive number of redirections on the web is also not the most appropriate because the passage from one to another implies more work for Google and can generate a delay in the loading speed.

We will see all this in the last section.

The 302 Redirect

The code 302 indicates that a redirect is temporary.

One of the aspects that differentiate a 301 redirect from a 302 is that in the case of the latter does not transfer force of SEO.

302 redirects are, as I say, temporary and their use is indicate for a while that url A will go to url B but when the order is removed everything will return to normal and “Page Rank” would not be transferred.

Using a 302 redirect can be useful in the following cases:

  • When we detect an error on the web. While we fix the problem, we may redirect the user to another similar page that may be of interest to them.
  • If we need to make major changes to the entire website, we can make maintenance work as minor as possible by using an alternative page.
  • To refer users to certain URLs on specified dates. For example, you can send users to a page with offers on Christmas or the week of Black Friday.
See also  Directory of plugins for WordPress -

Both 302 and 301 redirects they work the same way as we will see later.

When to do a 301 redirect

In most cases you will do a 301 redirectsince we will need to indicate to Google a proper architecture in the urls to improve usability and SEO, and this is done permanently.

We’ll see how to do a 301 redirect using code and through a plugin.

Using a plugin is always easier but using the .Htaccess file is also very simple and saves you the installation of other plugins in your WordPress.

How to make a 301 redirect (with and without plugin (htaccess)

You are going to see how a 301 redirect is done with and without plugins in a very simple way.

Watch this video where I explain everything Step by Step or continue reading the post where you will understand it in the same way.

How to make a 301 redirect without plugin (htaccess)

exist two ways to do this and although both are easy, the second one is simpler although I recommend using the first one to avoid possible failures.

  • Via FTP: you will find the file by accessing your server through an FTP client by accessing the Cpanel of your hosting in the file manager.

    You can also use the external tool FileZilla for example or any other.

    It’s very simple, once in the control panel files, inside the root of the web (public.html) you will see a .htaccess file.

    You will simply have to click on >Edit and you will be able to add lines in the code as in any txt file.

    In this case we will add redirects and we will see what is added here.

  • With the Yoast SEO plugin for WordPress: To do this, from the WordPress administrator you have to go to the left sidebar SEO>Tools>File editor.

    In File Editor you will see that you can edit the .

    You will also see the option to edit and create the Robots.txt() file.

    In both cases it’s always convenient before making changes to this file make a security copy.

Process for creating 301 redirects

Once inside htaccess either from the file manager or from the Yoast Seo option, to be able to start making 301 redirects as you want is very simple, just you have to insert the following commands depending on what you need:

Redirect a url to a new one:

Redirect 301 /old-url https://yourwebsite.com/new-url

With this simple code you are sending the order and the redirection is done.

You can save the changes and if you enter the url in the old one in the browser you will see that it goes to the new one.

You may want to do redirects not only from URLs and they are done in the same way by adding different codes as you can see if you continue reading.

Redirect an old domain to a new one:

RewriteEngine on RewriteCond %{HTTP_HOST} ^previoussite.com RewriteCond %{HTTP_HOST} ^www.previoussite.com RewriteRule ^(.*)$ https://newsite.com/$1

Redirect entire domain from non-www to www:

RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com RewriteRule ^(.*)$ http://www.example.com/$1 non www to www redirect

Redirects the entire domain from www to non-www:

RewriteEngine on RewriteCond %{HTTP_HOST} ^www.example.com RewriteRule ^(.*)$ http://example.com/$1 www to non www redirect

Redirect entire domain from HTTP to HTTPS:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} https redirect

NOTE You must have an SSL certificate installed on your website for this to work. Otherwise your website will continue to be insecure in https.

offers automatic migration from http to https in one click.

Redirect url without / to with / at the end:

It is possible that when you put links to the home page you do it without the / at the end of the url, or vice versa.

Maybe your entire site is with the slug at the end and in some links you have not added it. These are called mirror links and they can generate duplicities and you have to locate them.

They can be automatically detected in tools such as Seranking, a very good and cheap SEO tool, or establish a rule in the Htaccess:

RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)/$ http://www.example.com/$1

Redirect url with / to without / at the end:

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule (.*) http://www.example.com/$1/

Redirect directories:

If you want to redirect a directory to another name you can use the following rule.

Redirect 301 /old-directory/ http://www.example.com/new-directory/

How to do a 301 redirect with a plugin:

Simpler than the above is install a plugin.

For this we can use the .

Once installed and activated, it is extremely easy to handle since the Plugin shows you two fields.

In the first field (source url) you will put the old url to redirect and in the other (destination url)the destination page.

Doing this if someone accesses the first url will redirect to the second.

Also, from the same plugin you can see what 404 errors your website has and take action: Delete them in Search Console or redirect them to other addresses on the web.

As you have seen, the two methods are simple, fast and effective.

Thanks to this, you will no longer have broken URLs, improving the usability and SEO of your website.

But this is not all, if you really want make the most of redirects in a project To get the best web positioning, keep reading the next point.

301 redirects in SEO

The 301 redirects affect How have I…

Loading Facebook Comments ...
Loading Disqus Comments ...