Use Mod Rewrite to redirect visitors requesting a specific host to a new host

To redirect visitors requesting a specific host name to a whole new host name, use the following snippet in your .htaccess file:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^(www\.)?oldhost\.com$
  RewriteRule ^(.*)$ http://www.newhost.com/$1 [R,L]
</IfModule>

This will check for visitors requesting either oldhost.com or www.oldhost.com and redirect them to www.newhost.com.