MichaelHindley
MichaelHindley

Reputation: 493

Apache 2.2 HTTP_HOST not resolving to localhost correctly

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?

Upvotes: 2

Views: 1156

Answers (0)

Related Questions