Reputation: 128
Been trying this for several hours now but i am having a hard time figuring it out.
location ~* ^\/sys\/assets\/(.*).css$ {
try_files $uri $uri/ /sys/assets/stylesheets/$1;
}
I am basically trying to make css files called from /sys/assets/file.css to fallback to /sys/assets/stylesheets/file.css
Upvotes: 5
Views: 19605
Reputation: 25204
Your first match group is file name without extension, while you're passing it to the last fallback URL where extension is expected.
Also there's no point of escaping forward slashes. They have no special meaning here.
server {
listen 80;
server_name localhost;
root /var/www/localhost/www;
location ~* ^/sys/assets/(.+)\.css$ {
try_files $uri /sys/assets/stylesheets/$1.css;
}
}
Upvotes: 6