Get rid of args from $request_uri
chilly_bang
nginx-forum at forum.nginx.org
Tue Aug 8 09:42:55 UTC 2017
Hi
I want to build a construction like
location ~* {
if ($args ~ *) {
add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\"";
}
}
but need to get rid of argues from $request_uri. The goal is from any url
with parameters to point with canonical auf non-parameter url counterpart.
I've realized a method to get rid of argues from $request_uri, like this:
map $request_uri $request_uri_path {
"~^(?P<path>[^?]*)(\?.*)?$" $path;
}
I Need an advice - how are both snippets to put together?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,275930,275930#msg-275930
More information about the nginx
mailing list