Go back to entries 07-03-2018

Redirects of .htaccess

Redirects of .htaccess

It is possible that at some point we want to make a redesign of a website we can find that if we move to WordPress your domain does not match the old , or we have more than one domain and we want the URLs are like the old ones because we had a good positioning and we do not want to lose them. In these cases, the solution can be the use of redirects that are made from .htaccess .

First we define redirection, a redirection is to tell the server that a URL, or more than one, should be directed to another . To do it there are different shapes and different types. Here we explain the types of redirects and what to keep in mind when doing it.

Types of redirections

There are two types of redirections:

  • < strong> Permanent 301: This is to indicate that we change domain or URL structure.
  • Temporary 302: This is a bit weird because it means that it is redirected the URL to another for a while and then return to it.

The process of the two is completely transparent to the user since he will always see the same URL. But for search engines is important because they will consider it for future results. If they see a 302 redirect, they will be aware that the old URL is going to be enabled. If they see redirection 301, they will change the old URL to the new one in the search results.

Rules

One thing we have to take into account when making redirects is that we have to put the full destination URL . Although the redirections are within the same domain. The code that we will see will be something like this:

Redirect 301 /page.php?id=1 http://www.ejemplo.com/imagenes

It would be wrong to put the redirect if the Redirect domain 301 /page.php?id=1/images as it would give error.

You will have noticed that we have set the example with the redirect , this is because if we have many URLs we would have to write each one of the URLs. With redirect it can be simpler, if for example we migrated the website with a new URL, the only thing we would have to do is: Redirect 301 /http://www.dominionuevo.com/and everything that went to the old web to the new one because when it finds /indicates everything there is.

Author: Txell Casals

Access our section on tailor made projects Web Design

Comparte este artículo en tus redes sociales