Forum Moderators: phranque
RewriteEngine on
RewriteRule ^http://123.45.67.89/~example/$1$ htt*://www.example.com/$1 [R=301 L] Am I that simple or is mod_rewrite that complex? Help please.
The hostname is not part of the URL-path as seen by RewriteRule. You'll need to use RewriteCond to test %{HTTP_HOST}, and then redirect pages requested on that hostname over to the correct domain:
RewriteCond %{HTTP_HOST} ^123\.45\.67\.89
RewriteRule (.*) http:www.exampl.com/$1 [R=301,L]
Jim
It won't work on a shared IP. Anyone going to the shared IP will see CPanel's default page and never even get a chance to read the .htaccess file for that site.