I just got a list of urls that needs to be rewritten into nginx
example.com/cms.php/inspiration?fullsize > /
example.com/shop/?category_id=27 > /garden
Firstly, anything from the ? onwards is the query string and is not part of the normalised URI used by the rewrite and location directives.
One way to achieve your objective is to test the $request_uri variable using a map directive.
For example:
map $request_uri $redirect {
default 0;
/cms.php/inspiration?fullsize /;
/shop/?category_id=27 /garden/cushion.html;
/shop/?2008=1&vare_id=10553&variant_id=2232 /garden/cushion/black.html;
}
server {
...
if ($redirect) { return 301 $redirect; }
...
}
See this document for more, and this caution on the use of if.