Below is some info on how to change a site's domain name in a manner consistent with good SEO.
What you want to do is provide a 301 redirect for each page to the corresponding page in the new domain. If there is no a corresponding page you could do one of two things, redirect it to the top-level domain www.example.com) or leave it alone and the user will get a 404 Page Not Found error (not good!).
The Google Webmaster Blog provides step by step advice.
Here are the main points:
- Test the move process by moving the contents of one directory or subdomain first. Then use a 301 Redirect to permanently redirect those pages on your old site to your new site. This tells Google and other search engines that your site has permanently moved.
- Once this is complete, check to see that the pages on your new site are appearing in Google's search results. When you're satisfied that the move is working correctly, you can move your entire site. Don't do a blanket redirect directing all traffic from your old site to your new home page. This will avoid 404 errors, but it's not a good user experience. A page-to-page redirect (where each page on the old site gets redirected to the corresponding page on the new site) is more work, but gives your users a consistent and transparent experience. If there won't be a 1:1 match between pages on your old and new site, try to make sure that every page on your old site is at least redirected to a new page with similar content.
- If you're changing your domain because of site rebranding or redesign, you might want to think about doing this in two phases: first, move your site; and second, launch your redesign. This manages the amount of change your users see at any stage in the process, and can make the process seem smoother. Keeping the variables to a minimum also makes it easier to troubleshoot unexpected behavior.
- Check both external and internal links to pages on your site. Ideally, you should contact the webmaster of each site that links to yours and ask them to update the links to point to the page on your new domain. If this isn't practical, make sure that all pages with incoming links are redirected to your new site. You should also check internal links within your old site, and update them to point to your new domain. Once your content is in place on your new server, use a link checker like Xenu to make sure you don't have broken legacy links on your site. This is especially important if your original content included absolute links (like www.example.com/cooking/recipes/chocolatecake.html) instead of relative links (like .../recipes/chocolatecake.html).
- To prevent confusion, it's best to make sure you retain control of your old site domain for at least 180 days.
- Add your new site to your Webmaster Tools account, and verify your ownership of it. Then create and submit a Sitemap listing the URLs on your new site. This tells Google that your content is now available on your new site, and that we should go and crawl it.
- Finally, keep both your new and old site verified in Webmaster Tools, and review crawl errors regularly to make sure that the 301s from the old site are working properly, and that the new site isn't showing unwanted 404 errors.
Here are the important tips to think about:
- For each page on domain X, have it 301-redirect to the corresponding page on Y. (Typically this is done through .htaccess, but check with your hosting provider).
- http://www.google.com/webmasters is your friend. Keep an eye on it during the transition to make sure that the redirects are having the effect you want.
- Give it time. How quickly the transition is reflected in the results depends on how quickly Google will recrawl your site and see those redirects, which depends on a lot of factors including the current reputation of your site's pages.
- Don't forget to update your Sitemap and resubmit to Google Webmaster tools.
- If possible, don't substantially change the content of your pages at the same time you make the move. Otherwise, it will be difficult to tell if ranking changes are due to the change of content or incorrectly implemented redirects.
And finally here is a helpful video by Matt Cutts explaining the 301 Redirect process in pretty simple terms.