2011年3月18日星期五

Re: Running nginx as reverse proxy with Apache, rewrite problem

On 18 Mar 2011 20h30 WET, nginx-forum@nginx.us wrote:

> Try:
>
> Server {
> server_name site.com; listen 80; root
> /path/to/regular/content/; if ($http_user_agent ~*
> (mobile|android|blackberry|brew|htc|j2me|lg|midp|mot|netfront|nokia|obigo|openweb|opera\smini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|wap|webos|windows\sce)
> ) {
> rewrite ^ http://mobile.site.com$request_uri redirect;

Remember to add '?' at the end, otherwise you risk repeating the
query arguments.

Should be: rewrite ^ http://mobile.site.com$request_uri? redirect;

Ditto for the mobile.site.com server.

> }
> location /xyz/ {
> ...
> }
> }
>
> Server {
> server_name mobile.site.com; listen 80; root
> /path/to/mobile/content/; if ($http_user_agent !~*
> (mobile|android|blackberry|brew|htc|j2me|lg|midp|mot|netfront|nokia|obigo|openweb|opera\smini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|wap|webos|windows\sce)
> ) {
> rewrite ^ http://site.com$request_uri redirect;
This: rewrite ^ http://site.com$request_uri? redirect;
> }
> location /xyz/ {
> ...
> }
> }
--- appa

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

没有评论:

发表评论