Skip an argument when doing a 301 redirect in NGINX Skip an argument when doing a 301 redirect in NGINX nginx nginx

Skip an argument when doing a 301 redirect in NGINX


If the rewritten URL ends with a ?, rewrite will not copy any of the original arguments over.

For example:

rewrite ^ https://example.net/? permanent;

See this document for details.


Alternatively, use the simpler return expression:

return 301 https://example.net/;