I'm trying to redirect from an old hostname to the new one. So far I've got
RewriteEngine On
RewriteCond %{HTTP_HOST} ^foo$ [NC,OR]
RewriteCond %{HTTP_HOST} ^foo.company.com$ [NC]
RewriteRule ^(.*) http://bar.company.com/$1 [R=301]
but when I go to foo.company.com/dir/page.html
I don't get redirected. What am I doing wrong?
Turns out some mysterious incident caused three servers to reboot, including the old
foo.company.com
, it reverted to its old IP, and was fighting for it with the new server.Got my rules working and refined them to: