views:

25

answers:

1

I want to remove www. from my site url. I have added this to .htaccess:

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

It works if I type www.domain.com/x but not if I type www.domain.com/x/y. The rewrite "eats" the x value.

Thanks for your help.

+1  A: 

Try using

 RewriteRule (.*) http://mydomain.com%{REQUEST_URI}

for your rewrite rule instead.

Kevin Sedgley
It works. Thanks
Popovich88