2

Apparently the whole issue is a newly introduced bug in chrome v.24 and host resolving, the htaccess works fine in any other browser. No idea how to "close" this issue, if someone could point me to it ^^

trying to do a simple rewrite with Apache 2.2 running locally on windows.

RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

redirects to "www.localhost/"

Isnt the first line supposed to match for localhost?

Also tried these alternatives:

1
RewriteCond %{REMOTE_ADDR} !127.0.0.1
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

2
RewriteCond %{HTTP_HOST} !^(www\.|localhost$) [NC]  
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

3
RewriteCond %{HTTP_HOST} !^(www\.|127.0.0.1$) [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

4
RewriteCond %{HTTP_HOST} !^(www\.|localhost$) [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

5
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^localhost$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

6
RewriteCond %{HTTP_HOST} !^localhost$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Every single one goes to "www.localhost/", anyone got any idea what's wrong?

MichaelHindley
  • 485
  • 3
  • 7
  • What happens when you type `http://` in front of `localhost` in chrome? If not you could just change you hostfile and apache config to have www.localhost point to the same folder. – Gerben Feb 04 '13 at 17:50

0 Answers0