Redirect 301 to change domain name

When you’ve finished  the domain trasfer of out web site as explained in the previous guide , you have to inform all the search engines of the change you made, and to create an automatic redirect from the old site to the new one. The aim that you certainly have is not to lose the Search Engine Optimization (SEO) you had obtained with the previous domain. The way that leads you to success is very easy: you have to create a redirect 301, a permanently moved that redirect the visitors who click on old links, but at the same time it inform the visitor of our site permanent tranfer. Afterwards with Filezilla (that was a matter of the previous guide), you have to visit the old site , search in the site root the file .htaccess and modify it clicking on “View/ Modify“.
The notepad will be launched, now all you have to do is copy and paste the code I have written below, being careful while replacing  “iltuodominio.it”  with your own domain:

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.iltuodominio.it/$1 [R=301,L]
[/code]

Then you can close the notepad and save the changes. To check if your redirect works and gives back the code “301”, you can click here and write your old link. If you made no mistakes, this will be the result:

urltest-1-tuttodinternet
A screenshot from the free url-test program , made by tuttodinternet

Note:
If in the new link you want to remove, for example, “/blog/” , to have a redirect from:

www.iltuodominio.it/blog/post342 –> www.ilnuovodominio.it/post342

so you have to write:

 

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^blog/(.*) http://www.iltuodominio.it/$1 [R=301,L]
[/code]

If, instead, you would like to add “/blog/” to the new domain, you have to write:

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.iltuodominio.it/blog/$1 [R=301,L]
[/code]

 Translated by senzacca