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.
TigerTom at 19:21 on 18-Dec-2008
I find MOD_REWRITE to be:
1. A complete pain in the keister to code and
2. A godsend when you _do_ get it right.
Jon at 11:04 on 20-Feb-2009
If you insert [R=301,L] the redirect will be a "Moved Permanently" which will make it all official and stuff.