Answer the question
In order to leave comments, you need to log in
How to deny access by IP to a folder with pictures on apache?
Hello . There is a folder in public_html . It's called /uploads/
This folder has a folder where pictures are stored. It is called posts
In the /uploads/ folder, I uploaded the .htaccess file in which I wrote
<Directory /posts/>
Order deny, allow
deny from all
Allow from 217.30.160.0/20 217.29.112.0/20 217.12.80.0/21 213.230.64.0/18 213.206.32.0/19 212.115.112.0/22 и там еще около 90 IP сетей
</Directory>
Answer the question
In order to leave comments, you need to log in
httpd.apache.org/docs/2.4/mod/core.html#directory<Directory>
can only be used in the context of server config, virtual host.
If you push it into .htaccess, there will be an error 500
. there is no error and the pictures are downloaded, then either it is specified in the settings AllowOverride None
and Apache does not read .htaccess, or the pictures are distributed without its participation at all, for example, Nginx.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question