Setting up 301 redirect by .htaccess is the best way to keep your traffic and help search engines locate your new domain address. I was doing redirecting now and it is just a piece of cake. Anyone could complete it under 5 minutes.
Well there are times that we would like to migrate your site or your blog to a new domain. To migrate the entire site we could just change our .htaccess file to a simple line and you can do it no matter you are a programmer or not.
301 Redirect at Your Hosting FTP/Directory/Folder
If you have no experience of any knowledge on htaccess file, and do not want to spend time read and learn the coding and solve the problem, here are what you have to do, you will be able to complete that in a very short time:
1. Login to your hosting or go to your ftp hosting panel and locate folder where you put your hompage or mainpage at (homepage’s index page).
2. On the folder where you have your frontpage (index.php or index.html or index.phtml), locate a file named as .htaccess. If not, create a .htaccess file in that directory/folder. Remember, there is a [dot] in front and the name HAS TO BE EXACTLY like
copy and paste that to make sure there is no typing error. And upload the file to the directory mentioned.
3. Edit the .htaccess with this single line of code.
Redirect 301 / http://newsite.com/
Redirect 301 / http://www.newsite.com/
(for www redirection)
Redirect 301 means that you are telling the search engines the whole site is being moved to a new domain. The slash stands for the current site, following a space after with your new domain.
301 Redirect at Your vhost config File in Apache Server
If you are hosting your own domains like me, you can do this in an even simpler way, redirect the domain by modifying the httpd-vhosts.conf file directly.
Simply change the “Location” part with the redirect 301 line, others remain unchanged, here is a reference:
Redirect 301 / http://newdomain.com/
Test Your Links After Migration
After you have change your domain you have to restart the server to test it if you are doing your own hosting. Remember it may take sometime for you to see the effect. A good way to test it is to clear all the cache of your browser. Or you find that it is not working!
When it is all done, make a good habit of notifying the change of address in Google and Bing Webmaster tool to make sure they know about the change and so that they can crawl your new site. Submitting a new post or major change of source code on your front page can help to speed up the progress of search engines identifying the change of domain.