These rules work good in my .htaccess:
#https://workinnet.ru/de/wie-man-amazonbot-blockiert/#German language#
SetEnvIfNoCase User-Agent "Amazonbot" blocked_bot
<Limit GET POST HEAD>
Order Allow,Deny
Allow from all
Deny from env=blocked_bot
</Limit>
I tried this for use on Apache 4.4:
SetEnvIfNoCase User-Agent "Amazonbot" blocked_bot
<Limit GET POST HEAD>
<RequireAll>
Require all granted
Require not env blocked_bot
</RequireAll>
</Limit>
But this does not work. What is wrong?
Order
,Allow
,Deny
directives with the newer Apache 2.4Require
directive.)Require
directive is never considered "true". Access must be granted somewhere. From the docs, "when the Require directive is negated it can only fail or return a neutral result, and therefore may never independently authorize a request.". So, if you only have a (negated)Require not ...
directive then it won't actually do anything..htaccess
file with these directives in place. And what specific Apache version are you on? The most likely cause is that you have a conflict with other authorizing directives outside of this code block. Since the default container is<RequireAny>
, any authorizing directives elsewhere in the file that are not "contained" will take priority and authorize access. (Please also clarify that you are not on a LiteSpeed server masquerading as Apache - which could also cause these directives to be ineffective).