Answer the question
In order to leave comments, you need to log in
How to change uri in nginx?
Tell me how to configure nginx
location config ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
log_not_found off;
} So that
/v0 example.ru/article/main.html
would be excluded from the incoming request
example.ru/article/v0/main.html
or
/v1 example.ru/ would be excluded from example.ru/img/v1/images.jpg img/images.jpg
And the requested data was selected from the appropriate folders, that is,
root/article/main.html
root/img/images.jpg
Answer the question
In order to leave comments, you need to log in
You can depict such a hell in the location:
rewrite ^/([^/]*)/([^/]*)/(.+\.(js|css|png|jpg|jpeg|gif|ico|html))$ /$1/$3 break;
rewrite ^/(img|article)/([^/]*)/(.+\.(js|css|png|jpg|jpeg|gif|ico|html))$ /$1/$3 break;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question