开发者

apache mod-rewrite removing www from url

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 "e开发者_如何学Goats" the x value.

Thanks for your help.


Try using

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

for your rewrite rule instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜