php8/conf/etc/apache2/conf-enabled/block_bots.conf

32 lines
770 B
Plaintext

<LocationMatch ".*">
SetEnvIfNoCase User-Agent "MJ12bot" bad_user
SetEnvIfNoCase User-Agent "YandexBot" bad_user
SetEnvIfNoCase User-Agent "YAhrefsBot" bad_user
SetEnvIfNoCase User-Agent " SemrushBot" bad_user
Deny from env=bad_user
</LocationMatch>
<If "%{HTTP_USER_AGENT} == 'MJ12bot'">
Deny from all
</If>
<If "%{HTTP_USER_AGENT} == 'YandexBot'">
Deny from all
</If>
<If "%{HTTP_USER_AGENT} == 'YAhrefsBot'">
Deny from all
</If>
<If "%{HTTP_USER_AGENT} == ' SemrushBot'">
Deny from all
</If>
<Directory />
SetEnvIfNoCase User-Agent "MJ12bot" bad_user
SetEnvIfNoCase User-Agent "YandexBot" bad_user
SetEnvIfNoCase User-Agent "YAhrefsBot" bad_user
SetEnvIfNoCase User-Agent " SemrushBot" bad_user
Deny from env=bad_user
</Directory>