I am attempting to get the following 2 blocks of directives to work together, but for some reason the <Location>
block is taking precedence over the <Files>
block, regardless of what order I put them in:
SetEnvIfNoCase User-Agent "baidu" badbot
SetEnvIfNoCase User-Agent "meanpath" badbot
SetEnvIfNoCase User-Agent "seoengbot" badbot
SetEnvIfNoCase User-Agent "spinn3r" badbot
SetEnvIfNoCase User-Agent "ahrefs" badbot
SetEnvIfNoCase User-Agent "yandex" badbot
SetEnvIfNoCase User-Agent "dotbot" badbot
SetEnvIfNoCase User-Agent "webtarantula" badbot
SetEnvIfNoCase User-Agent "spiderbot" badbot
<Location />
order allow,deny
allow from all
Deny from env=badbot
</Location>
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
ErrorDocument 403 "Denied"
Allow from 127.0.0.1
# should be Wordpress.com allowed
Allow from 192.0.64.0/18
</Files>
When I remove the first block then access is correctly denied on xmlrpc.php server-wide, when it is in there it is allowed again. Is there a way to get these directives to coexist peacefully? It's Apache 2.2.29 on CentOS 6.7.