T
T
Tsarev Vadim2021-06-08 21:19:18
Apache HTTP Server
Tsarev Vadim, 2021-06-08 21:19:18

How to properly block Apache2 bots correct if that?

Am I blocking bots correctly, I work on apache for the first time / what is the best way?

apache2.conf/.htaccess
SetEnvIfNoCase User-Agent "Yandex" bad_bots
SetEnvIfNoCase User-Agent "......" bad_bots
.....


<Directory /var/www/>
    Options FollowSymLinks
    AllowOverride None
  
  <RequireAll>
       Require all granted
       Require not env bad_bots
  </RequireAll>
</Directory>


images/.htaccess
Deny from all

<Files ~ "\.(jpe?g|png|gif)$">
  Order deny,allow
  Deny from env=bad_bots
</Files>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question