Forum Moderators: phranque
Now the question, since implementing the above solutions and diligently studying my error logs, I found instances where somebody tried to implement CGI scripting to grab one of my 8 sites (unsuccessfully). <snip> ...But the kicker is my site is a free site! Why would someone need to try and grab my site if its free...who knows.
I would like to ban the IPs as I have a WhoIS software and identified the offending IPs. Problem, I have about 30 IPs and ranges of IPs too. I want to totally ban these folks into the cyber blackhole. I know the IP listing will go. I'm looking for simplicity and not to have my .htaccess so bloated that I need Contents to read it. Will using the "SetEnvIf" be appropriate or the DENY directive? or implementing a scripting solution for automation?
Again, thanks!
[edited by: jdMorgan at 11:16 pm (utc) on Jan. 26, 2005]
[edit reason] Removed specifics [/edit]
Welcome to WebmasterWorld!
> Will using the "SetEnvIf" be appropriate or the DENY directive?
Not sure I understand the question here. SetEnvIf is used to set an environment variable depending on the value of a request-based variable, such as the IP address, user-agent, referrer, etc. The Allow and Deny directives can then be used to allow or deny access based on the value of the variable set by SetEnvIf. You can create "Deny from" directives based on the visitors' IP addresses or on environment variables, but not on other request variables. So, if you want to deny access based on anything except IP addresses, you need both. You can also use the SetEnvIf method for IP addresses, but this is optional.
Here's a mixed-use example:
# Set "ban" variable for unwelcome visitors
SetEnvIf Remote_Addr ^192\.168\.68\.134$ ban
SetEnvIf Remote_Addr ^192\.168\.69\. ban
SetEnvIf User-Agent ^larbin ban
SetEnvIf Referer iaea\.org ban
SetEnvIf Remote_Addr ^192\.168\.157\.1(7[6-9]¦8[0-9]¦9[01])$ ban
#
# Block unwelcome visitors except for custom 403 pages and robots.txt file
SetEnvIf Request_URI "(403[^.]*\.html¦robots\.txt)$" allowit
<Files *>
Order Deny,Allow
Deny from env=ban
Deny from 192.168.0.0/24
Allow from env=allowit
</Files>
Jim