5

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

1 Answer 1

6

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; } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.