1

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?

1 Answer 1

1

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:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^foo$ [OR]
RewriteCond %{HTTP_HOST} ^foo.company.com$
RewriteRule ^/?(.*)$ http://bar.company.com/$1 [R=301]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.