What is a redirection 301 and how it is made correctly

redirection-php

If you have a blog or a store online, perhaps at some time you have needed to send to the visitors from a page to another one.

And when you begin to inquire on the subject, an expression is repeated constantly: redirection 301. 

In each page that consultations, are there but, what is a redirection 301?  Why it is so important? How it is made?

Those are the doubts that we want to clear you in the next lines so, ponte comfortable and takes note.

We directed you by the post. 😉

 

What is a redirection 301?

Then something very simple. It consists basically of directing of automatic form to the visitors of a direction Web of another one. But in case it has not been clear absolutely, we are going to see it with an example.

He imagines that you have a webpage in which you sell different products. Suddenly, one of them remains obsolete and you far better replace it by a new version. So that your clients cannot accede to the old product, flocks its page.

Error! In order to begin, although you eliminate that direction, follows indexed in the directory of Google and when its robot returns to try to accede to her, something bad will happen (we explained to you more ahead what).

But to part of that, in other sites of your store online they can be connections to that page that you have erased and, when your users puncture and appears in their screen frightful error 404, its perception on your business will change worse.

This it is an example, but other situations exist in which a redirection 301 will help you:

  • Duplicated content.
  • Directions that do not exist.
  • Change of URL.
  • To migrate to a version https.
  • Etc.

In those situations, to use this tool will avoid headaches to you.

 

1. And a redirection 302?

Perhaps, during your search of information it exceeds how to redirect a webpage, you have seen that there are two ways to do it: the 301 and the 302.

In what they are different? In an only detail: what they last in the time.

Whereas redirection 301 is considered as something definitive, redirection 302 is a form to indicate the robot to him of Google that is something temporary.

 

Why it is so important to make a redirection 301?

When you have a business online, certainly great part of your efforts you dedicate it to appear in the first positions of Google.

You remember when we have spoken of which “something bad will happen” if their robots did not find a page that had indexed? Then to which we talked about it is that, the giant of the searches in Internet, will send your webpage to worse positions.

There the importance of redirections 301 resides (or 302 if she is not definitive).

In order to see it more clearly, thus Google acts when it runs into with one:

  1. Acquittal of its index the old direction.
  2. It adds the new page.
  3. It transfers all the value of the old one to the new one.

That last step is the one that interests to you, since it means that you will not lose positions. Thus, all your effort to reach the first results will not go away to garete.

 

Forms to make a redirection 301

Once you already know of what it consists and why it is a tool indispensable for your webpage, we want to tell the 2 options you more common to realise a redirection 301.

 

1. From the file .htaccess

The option that we could denominate “Spartan option now” and you will see why.

It is not that it is difficult to realise nor that requires some advanced knowledge of computer science and servers, but that you will touch in a delicate file of your webpage.

Summarizing, if you do not go with care, you can roll it brown. But nothing that is not solved making a backup copy.

The steps to follow are the following:

  1. It accedes to the servant: by means of FTP. For that, you can use programs as FileZilla or WinSCP.
  2. It locates the file: normally it will be in a folder that will be called “www”, “httpdocs”, or “public_htlm”. It can also be that he is hidden.
  3. It publishes the file: more ahead we told you how to do it.
  4. Guard: so that the modifications rise the servant.

php-redirect

Now we are going to teach to you what you must add to him based on your needs. And our first advice, is that you write what you write, you always do it at the end of the document.

That yes, to have certainly will work, adds in forward edge this code to activate mod rewrite:

Options +FollowSymlinks
RewriteEngine on

 

A. To redirect a page

If you want to direct to which enters a direction of another one, this is the structure:

Redirect 301 /antigua-pagina http://www.tudominio.com/pagina-nueva

And if you want to do it with the page of beginning, it would be thus:

RedirectMatch 301 ^/$ http://www.tudominio.com/pagina-nueva

 

B. To redirect a folder

At the time of working with directories the structure one stays intact:

Redirect 301 /viejo-directorio/ http://www.tudominio.com/directorio-nuevo/

There is no problem in playing with directories and subdirectories:

Redirect 301 /directorio/sub-directorio/ http://www.tudominio.com/directorio/subdirectorio-nuevo/sub-directorio/

 

C. To redirect a domain

The moment can arrive, at which you need to change of direction name. In order to take to your visitors to your new page, it uses this structure:

Redirect 301/http://www.tunuevodominio.com/

 

D. Redireccionar to HTTPS

In 2014, Google began to award to the Webs that use HTTPS instead of HTTP with better positions. If your page counts on this protocol, you would have to make sure that all that enters does it always that way.

For it, a redirection 301 is ideal, although in this case the structure is different:

<IfModule mod_rewrite.c>
RewriteCond % \ {HTTPS} in off
RewriteRule (. *) https://www.tudominio.com/$1 [R=301, L, QSA]
</IfModule>

 

2. From WordPress

If you do not feel with the confidence to work at that level with your webpage and use WordPress, you can make a redirection 301 with plugin.

Thus, although you can continue putting the leg, will be more complicated than you do it until the bottom. 😉

You have a pile of alternatives to choose. We recommended any to you of the following:

You use another one? Tell it to us in the commentaries more down.

 

What is a redirection 301? A wonder

You already know what is a 301 redirection and the important thing that it is for your webpage.

And now we asked to you:

  • Already you had done one before?
  • You knew all their power?

Tell it to us in the commentaries.