You really want to add this to your .htaccess file:
Redirect 301 / http://your-new-domain
Let’s break that down.
- “Redirect” is pretty obvious, it tells the web server to redirect the request.
- “301” is a special code that tells any search engines that come by that this change is permanent, and they should update their results to reflect the new URL. (Using “302” instead would set it as a temporary move.)
- “/” just means the entire site, from the very top directory has been moved.
- “http://your-new-domain” or indeed, whatever your new URL is, is the new domain that all requests should be sent to. Note the final “/” on the end.
Easy peasy! Now all bookmarks, and search engine results will still be valid and get people to your new address, with one short piece of code.