Forum Moderators: phranque
I've tried loads of variants but I don't seem to be able to stop my bandwidth dissapearing.
I tried:
Order allow,deny
Allow from all
Deny from domain.com
Deny from .*.st
Deny from .*.ki
Deny from *.cc
Deny from .*.by
But this doesn't seem to work - I've also tried lots of other ways.
Could someone point me in the right direction and will it save my bandwidth?
Thanks in advance,
Chris
It's not at all obvious, but access control by domain can be very inefficient. Each "test" requires the server to take the requesting IP address and do a reverse-DNS lookup on it, effectively stalling the request until the domain is returned from the DNS system. As such, you can use it for "emergencies" and in tightly-scoped situations, but I can't recommend that you use it as a matter of course for all file requests. If you do, your server will be issuing as many requests as it receives!
If you wish to proceeed, you can use mod_setenvif [httpd.apache.org] to pass a control variable to mod_access [httpd.apache.org]. Here's a basic outline:
SetEnvIf Remote_Host \.st$ badguy
SetEnvIf Remote_Host \.ki$ badguy
...
Deny from badguy
Some servers are configured to block reverse-DNS lookups, so test a simple version before spending too much time on it.
Jim
I also had a question on this. I have the following syntax so can you please specify whether it will work under this circumstance?
Jio
--------------------------------
RewriteEngine On
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://example.com [NC]
RewriteCond %{REQUEST_METHOD} ^POST$
RewriteRule ^/POSTprocessing.cgi - [F]
--------------------------------