Forum Moderators: phranque

Message Too Old, No Replies

.htaccess problem

         

Elrion93

5:45 am on Jan 19, 2011 (gmt 0)

10+ Year Member



Hi. First of all, sorry for my english.

I want to redirect non-www url to www, and i have this code:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ [%{HTTP_HOST}$1...] [R=301,L]

The problem is that if i want to navigate to [localhost...] Apache redirects to www.localhost.com, and i don't want it.

Thanks.

g1smd

6:50 pm on Jan 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This change, or something similar:

RewriteCond %{HTTP_HOST} !^(localhost|www\.)

Elrion93

8:46 pm on Jan 19, 2011 (gmt 0)

10+ Year Member



Thanks a lot! You are my new god :D