Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to set up an nginx rewrite rule to modify the URL with query request.

E.g.:

www.abc.com/pathA/pathB/script.pl?paraA=10&paraB=20

should be rewritten to:

www.abc.com/pathA/pathB/script.pl.1020

I try to use variable $args or $query_string (based on the nginx documentation they are the same) to check whether the URL has a query request. But I found $args (or $query_string) only has the contents before &.

In my example, it means $args = paraA=10. I can't get the parameter contents after &. I determine this through the nginx error log with the level set to debug.

Any idea why I can't get the query parameters after & in variable $args or $query_string?

like image 553
bubu0321 Avatar asked Nov 29 '22 22:11

bubu0321


1 Answers

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.

like image 164
bubu0321 Avatar answered Dec 04 '22 23:12

bubu0321