Take this code for the example in the .htaccess.
When you do that actually you tell the server to ask the browser to load the new site when the visitors are in the old domain name. So, how about the searching engine? The searching engine also follow the link to index the new URL, and transfer the page rank of your old page to the new one.But what if we don’t have the .htaccess file or the web host doesn’t allow doing so? Well, you could set up an automatically redirecting page by inserting the following

Well, I hope this tutorial will help you a lot out there!! Adios!!!