Create custom variable based on another one

pixeye nginx-forum at forum.nginx.org
Thu Aug 4 13:38:31 UTC 2016


Hai,

Thanks for your response !

$1 did not work for me :
nginx: [emerg] unknown "1" variable
nginx: configuration file /etc/nginx/nginx.conf test failed

For future reference, here is what i used :

map $request_uri $path {
   ~^(?P<pathname>/[^/]+)/ $pathname;
   default /;
}

seems to work in all my cases.

but, if you want to explain, not sure about what this do : (/|$) 

Thanks !

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,268761,268768#msg-268768



More information about the nginx mailing list