Answer the question
In order to leave comments, you need to log in
How to use a regular expression to select a folder with any name?
I want to specify any directory name in the exception, but for some reason it does not work (.+), swears that there is no fixed length
+ A quantifier inside a lookbehind makes it non-fixed width
^/c/.+\.(min\.js|js|php|cgi|pl|phtml)(?<!index\.php|d\.php|t\.js|app/project/_resource/s/|app/project/ вот_тут_любое_имя_каталога /js/с\.min\.js)
Answer the question
In order to leave comments, you need to log in
In the /c/ directory, deny access to all files except:
/c/index.php
/c/d.php
/c/t.js
/c/app/project/_resource/s/
/c/app/project/[^ /]+/js/c\.min\.js
location ~ ^/c/(?!index\.php|d\.php|t\.js|app/project/_resource/s/|app/project/[^/]+/js/c\.min\.js) {
return 403;
}
location ^~ /c/ {
return 403;
location ~ ^/c/(index|d)\.php {
fastcgi_pass ...;
include fastcgi_params;
}
location = /c/t.js { }
location /c/app/project/_resource/s/ { }
location ~ ^/c/app/project/[^/]+/js/c\.min\.js { }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question