How to redirects HTTP 301

When your browser consumer connects to an internet site over the net, it sends associate degree HTTP request to its website for the knowledge it's trying to find. the web site then responds with associate degree HTTP standing code to tell the consumer however it'll contend with its request. the foremost common standing code is two hundred, which suggests the request was received and is being processed by the server.


In the case wherever the situation of a resource has modified, the HTTP standing codes 301 and 302 square measure used. there's a very important distinction between these 2 standing codes: 301 means that the resource the consumer is trying to find has enraptured for good, whereas 302 means that the resource has enraptured locations briefly. In each case, the server returns the new location wherever it will notice the knowledge it's trying to find.


If the consumer receives a 301 response, the consumer interprets the new address for that resource provided by the server because the new permanent location wherever it will notice it and can use the new location in future requests. In 302 responses, the consumer considers the new address provided by the server temporary for that request solely and can still request the resource from the previous address in future requests.


A question we tend to get usually from involved website house owners is once it's applicable to use a 301 direct. even as shoppers use HTTP standing codes to know the context of a server response, therefore do search engines. If the situation of a page or resource has for good or indefinitely modified, that's once it's applicable to use a 301 direct. However, if the situation of a resource has solely modified briefly – and there square measure several things wherever this will happen – then you must use a 302 direct. it's vital to ne'er use the incorrect standing code as a result of search engines that see a 301 direct can think about the new address given by the server because the permanent new location for the resource it's requesting.


It may conjointly take time for search engines to update its index to mirror changes you’ve created to the situation of pages on your website, therefore don’t expect it to happen directly or directly once an exploration engine bot/spider crawls your website.


The most vital kind of direct to concentrate on is that if you wish to alter domains. A 301 direct not solely tells search engines your site’s new location, it conjointly maximizes the probabilities search engines can transfer your domain authority and rankings to your new domain. Otherwise, it'll be treated as a replacement web site which suggests you’ll be ranging from scratch with no authority and low rankings. altogether cases, there is, sadly, no guarantee that your domain’s authority and rankings can transfer over to your new domain, and Google will warn they're underneath no obligation to try and do, therefore.


If you are doing ought to modification domains, you must solely begin putt 301 redirects in situ once you've got allowed enough time for name server propagation if your new domain had nameservers antecedently set. you must conjointly ensure the inner pages of your website have 301 redirects in situ to your new domain. you are doing not ought to produce associate degree Apache rule for every page on your website if they'll be within the same location underneath your new domain – in this case, a standard rule will be used like this (modify it in keeping with your needs)


Options +FollowSymlinks

- RewriteEngine On

- RewriteCond %{HTTP_HOST} ^old.example.com [NC]

- RewriteRule ^(.*)$ HTTP://www.new.example.com/$1 [L,R=301]

- RewriteCond %{HTTP_HOST} ^www.old.example.com [NC]

- RewriteRule ^(.*)$ HTTP://www.new.example.com/$1 [L,R=301]

If the location of your site’s pages is changing along with your new domain, you will need to have individual 301 redirects in place for each affected page. For example:

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