Nginx rewrite infinite loop

Steve Zhuo lists at ruby-forum.com
Fri Jul 29 04:33:26 UTC 2011


Hi.

I tried to rewrite all non-www url to www url, but when i tried to
access the site, i got the infinite loop. following is my config

server {
   server_name www.example.com;

}
location / {
......

 rewrite ^ http://example.com$request_uri? permanent;
 proxy_pass http://example.com

}


but if i change to redirect to the www url with locale(like, en, zh_CN),
it works fine. following is the config.

server {
   server_name www.example.com;
}

location / {
......

   rewrite ^ http://example.com/zh_CN$request_uri? permanent;

}

location ^~ /zh_CN {
........

  proxy_pass http://example.com
}


any help is appreciated.

Thank You


Steve

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list