Quantcast
Channel: linux
Viewing all articles
Browse latest Browse all 81

Nginx configuration: How to drop the query string on a rewrite

$
0
0

Nginx configuration: How to drop the query string on a rewrite

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.


Viewing all articles
Browse latest Browse all 81

Trending Articles