I have a number of domains pointed to the same webserver and would like to set it up to rewrite all incoming traffic to be under one consistent domain. I have done this before do make sure that the request has a www. in it, but when I added the script below to be site it started freezing up.
RewriteCond %{HTTP_HOST} !^www\.domain\.com(.*) [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
After I add this to my .htaccess (above all my other rewrites) and save the file to the server, the site will operate normally for around 10 seconds and after that requests to it will start freezing up. I know this is VERY weird, this happens AFTER the file is saved to the server. If I remove the lines above it will start working immediately.
I am a little lost as to what could be causing this strange problem.
UPDATE: I checked my rewrite logs comparing before and after the change was made. I see a lot of these error
127.0.0.1 - - [21/Jul/2010:12:57:35 --0400] [280082-web1.dummy.com/sid#2b4899b49d30][rid#2b489a396148/initial] (2) [perdir /var/www/html/] rewrite '*' -> 'http://www.dummy.com/*'
127.0.0.1 - - [21/Jul/2010:12:57:35 --0400] [280082-web1.dummy.com/sid#2b4899b49d30][rid#2b489a396148/initial] (2) [perdir /var/www/html/] explicitly forcing redirect with http://www.dummy.com/*
I also checked my access logs for the same timestamp and see this:
127.0.0.1 - - [21/Jul/2010:12:57:35 -0400] "OPTIONS * HTTP/1.0" 301 333 "-" "Apache/2.2.3 (Red Hat) (internal dummy connection)"
I do have keepAlive turned on. Could this be causing the problem?
Also tried adding this cond to my rewrite, and it still errors: RewriteCond %{REMOTE_ADDR} !127.0.0.1