Why does $args or $query_string not include the query parameters after &? Why does $args or $query_string not include the query parameters after &? nginx nginx

Why does $args or $query_string not include the query parameters after &?


You need to use $arg_<argname>

www.abc.com/pathA/pathB/script.pl?paraA=10&paraB=20will be rewritten to : www.abc.com/pathA/pathB/script.pl.1020

Below is a sample config to do such a thing

location /pathA/pathB/script.pl {    set $need_redirect "";    if ($arg_paraA) {       set $need_redirect "A";    }    if ($arg_paraB) {       set $need_redirect "B$need_redirect";    }    if ($need_redirect = "BA") {       rewrite ^(.*)$ $1.$arg_paraA$arg_paraB;    }}


The problem is not caused by nginx configuration file. It is caused by I forget double quote when I sent request using curl. E.g.:curl "www.abc.com/pathA/pathB/script.pl?paraA=10&paraB=20"Without double quote, "&paraB=20" never be sent actually.