As a quick note, if you need to drop the query string when configuring an Nginx
rewrite request, this syntax works:
rewrite ^/foo/bar.*$ /bar? permanent;
The key is to use the
? character at the end of the URL/URI you are redirecting users to. That drops the query string, so the user will be redirected to the exact /bar URI.
For more information, see the Nginx rewrite module page.