In Nginx, I\'m trying to define a variable which allows me to configure a sub-folder for all my location blocks. I did this:
set $folder \'/test\'; location
You could do the opposite of what you proposed.
location (/test)/ { set $folder $1; } location (/test_/something { set $folder $1; }