Forum Moderators: phranque
Here is the code I have tried in my htaccess file:
SetEnvIfNoCase Request_URI ^/ban-ip/ban-ip.txt$ ban
deny from env=ban
*If you need my full htaccess file I can post it if it will be helpful.
Thanks
If you have server configuration-level privileges so that you can modify httpd.conf or conf.d, for example, then you can define a RewriteMap function in mod_rewrite in the config file, and access that map from .htaccess using the rewritemap-access method of RewriteCond and RewriteRule.
Otherwise, I'd suggest implementing your access controls as a script included on your pages, or writing a script to serve your pages by checking access controls and then reading and sending their content.
Another possibility is to write a script that takes your ban-list text file as input, and creates or prepends mod_setenvif directives to your existing .htaccess file, based on manual invocation or a periodic cron job.
Jim
I like this method rather than filling up my htaccess file with deny from IPs.
Thanks for the advice/response.
Now I just need a way to catch the spam bots that try to post to my PHPBB forum. Any ideas?
Jim