'Replace one of the segment with a wildcard in a simple way?
I have this code in nginx config:
location ~ ^/assets/(static|dynamic)/(images|styles|scripts|fonts|videos|audios|var)/(.*) {
alias /var/web/app1/assets/$1/$2/$3;
autoindex off;
expires 366d;
}
Now I want to replace the (images|styles|scripts|fonts|videos|audios|var) with a wildcard. And everything should continue to work as-is. That is, in that segment, there could be a directory with any name whatsoever.
Is there a simple way to do it in a simple way? Preferably without a regexp.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
