Answer the question
In order to leave comments, you need to log in
How to prevent nginx from accessing a specific url?
Such a situation, you need to prohibit access from all ip addresses, except for certain ones, to www.example.ru/en/safe/. At what such way really does not exist. rewrite enabled.
such rewrite
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?url=$1 last;
}
}
With such an entry, it gives 404
location /en/safe {
allow (my ip);
deny all;
}
Answer the question
In order to leave comments, you need to log in
there is no nginx at hand, you need to check:
rewrite.inc:
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?url=$1 last;
}
index index.php index.html;
location /en/safe {
allow (мой айпи);
deny all;
include rewrite.inc;
}
location / {
include rewrite.inc;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question