In Wordpress, one of the few effective ways at reducing server load is to whitelist individual clients to /wp-login.php
and /wp-admin/
:
<Directory /wp-admin>
order deny,allow
deny from all
allow from 10.1.1.50
allow from ...other ips...
</Directory>
But I don't want to have to edit and reload Apache to change this list. In my Virtual Host, I want:
<Directory /wp-admin>
RewriteEngine On
RewriteMap hosts-allow txt:/var/www/html/wp/wp-admin/hosts.allow
RewriteCond ${hosts-allow:%{REMOTE_ADDR}|NOT-FOUND} =NOT-FOUND [AND]
RewriteCond ${hosts-allow:%{REMOTE_HOST}|NOT-FOUND} =NOT-FOUND
RewriteRule ^ - [F]
</Directory>
But:
[root@blah httpd]# service httpd reload
Reloading httpd: not reloading due to configuration syntax error
[FAILED]
[root@blah httpd]# apachectl -S
Syntax error on line 34 of /etc/httpd/sites-enabled/example.org.conf:
RewriteMap not allowed here
So is there a way to accomplish what this says that doesn't require RewriteMap or do I need to write a new module?