<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^from.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.from.com$
RewriteRule (.*)$ http://to.com/$1 [R=301,L]
</IfModule>