How to redirect to a query

Igor Sysoev igor at sysoev.ru
Wed Mar 9 12:56:24 MSK 2011


On 09.03.2011, at 12:51, sjark wrote:

> Same problem I get this error in chrome 310
> (net::ERR_TOO_MANY_REDIRECTS):
>
> [code]
> server {
>    listen       80 default;
>    server_name  www.mysite.com;
>    root   /home/www/mysite;
>    include standard.conf; #php-fpm settings
>
>    location = / {
>      rewrite ^ /?index=site&id=1? permanent;
>    }
> }
> [/code]


location = / {
     if ($arg_index = "") {
         rewrite  ^  /?index=site&id=1 permanent;
     }

     fastcgi_pass   ...
     ... etc ...
}

or you may do without redirect at all:

location = / {
     fastcgi_pass   ...
     fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
     fastcgi_param  QUERY_STRING     index=site&id=1;
     ... etc ...
}


--
Igor Sysoev
http://sysoev.ru/en/




More information about the nginx mailing list