Answer the question
In order to leave comments, you need to log in
How to NOT forward $args in nginx rewrite?
Then I suddenly ran into a problem, what kind of rewrite is:
rewrite ^/([0-9]+)/$ /index.php?id=$1 last;
When requesting the form /1234/?id=4321
, it actually passes 4321 in $_REQUEST['id'] , not 1234.
Moreover, in such a rewrite
rewrite ^/some/([0-9]+)/$ /index.php?secret=abc&id=$1 last;
Answer the question
In order to leave comments, you need to log in
nginx.org/ru/docs/http/ngx_http_rewrite_module.htm...
If the replacement string specifies new query arguments, then the previous query arguments are added after them. If this behavior is undesirable, you can opt out of this addition by ending the replacement string with a question mark
rewrite ^/([0-9]+)/$ /index.php?id=$1? last;
rewrite ^/some/([0-9]+)/$ /index.php?secret=abc&id=$1? last;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question