If you want to change the page or url location of a file but you are worried about losing search engine positioning, specifically you are worried that Google will not find the new file and you will lose those valuable visits, this post is of interest to you.

What is a 301 redirect for?

A redirect, as its name suggests, is an automatic reference or change, practically transparent to the user, which is carried out at the code level and which allows the permanent location of the new article or note to be indicated.

In what cases should a 301 redirect be used? 

When the change of location is permanent, either because the url has been slightly modified, for example, if the product was previously at www.tienda.com/index.php/producto2.html and now it will just bewww.tienda.com /broom-product

It can also be used when changing the name, brand and therefore domain so as not to lose the traffic that searches for us with the other domain. Example, before the website was www.tiendaanterior.com and now it will be www.masclicks.com.mx

How do you do a 301 (permanent) redirect then?

The answer is simple, however it is worth clarifying that it is done 100% at the code level and the editing of files sensitive to damage is required.

The first option is to edit file by file each url that we seek to change, with the possible amount of work that this implies.

Here is the example of redirection in php

http://www.New-Website.com”); ?>

Or if you use Linux like most websites, the procedure can be easier from the htacess file, just add a line like this to the file:

redirect 301 /previous_url.html http:// domain.com/new-url/

As you can see in the example, the domain could be changed or not, just indicate it and the htacess file will process the new requests.

If you are not familiar with code editing beyond changing small elements in a CMS, we highly recommend that you approach an expert in the language that your website is developed in, PHP for example.

If you have questions, leave a comment on this blog and we will surely guide you how to achieve it on your own.