The redirect is an automatic readdressing of users from one URL address on another. Technically the redirect can be carried out in different ways. It can work both at server side, and at client side (in the browser).
Redirect — a concept from the field of Internet technologies. The redirect represents automatic redirection of the user from one web address on another. It works as follows: for example, the user gathers the address ""site.ru"" in an address bar of the browser, but after automatic readdressing gets on the website with the address ""www.new-site.ru"".
For what the redirect is necessary?
The most widespread situation is a shift of a domain name of the website. Need for a redirect most often arises in a case with the commercial websites not to lose clients who visited the website to the old address. Most relevant it for online stores which moved to other domain, but clients still visit a page of shop to the nonexistent address.
The second widespread case of application of automatic readdressing, is gluing together of domain names. The URL address of any Internet resource can be entered into an address bar completely, that is with www — ""www.site.ru"" and without www — ""site.ru"". However search engines perceive these two address designs as two absolutely different websites. Therefore it is necessary to specify one of these addresses in settings of the server as the main (the main mirror), and from the second address to carry out a redirect on the main mirror. Then visitors anyway will get on a resource necessary to them, and search robots will correctly define the main mirror.
Gluing together of domain names can be implemented in different ways. An alternative of creation of a script of a redirect is setup of the main mirror in a personal account of Yandex webmaster. For this purpose it is necessary to create previously the account in the system of Yandex webmaster and to add there the website. But in order that search engines of Yahoo and Google correctly defined the main mirror, 301 redirects which are created in the htaccess file will be required. This file is stored on the server in a root directory of the website.
What is 301 redirects?
Number 301 is the status code of a redirect, occurring at the level of the server. This code indicates that the resource or its separate page will be to other address constantly. It should be noted that for temporary movements the status code 302 is used.
Most often 301 redirects are used to stick together domains with www and without www. Also it is irreplaceable when the website moves to the new domain. In addition, it is applied at transfer of internal pages of the website.