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
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;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With