2011年2月17日星期四

Re: remove www from the url

Thank you all. Your solutions seem quite elegant.

Just a note, I was hoping for something I can do inside the server only
declaration, just like I can do with the opposite redirection mysite.com
--> www.mysite.com:

[code]
server {
server_name www.mysite.com mysite.com;

if ($host !~* www\..*) {
rewrite ^(.*)$ http://www.$host$1 permanent;
}
[/code]

On the other hand, I feel your solution with the two server declaration
can even be a bit faster (not to mention easy to understand). Your
solution suggests I should rewrite the above code into two server
declarations as well.

Thank you very much!
Jiri

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,176137,176146#msg-176146


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

没有评论:

发表评论