-----Original Message-----
From: Bennett Haselton
Sent: 24 July, 2010 0:10
To: users@httpd.apache.org
Subject: [us...@httpd] trying to ban IPs using htaccess - not working
I'm trying to ban certain IPs from visiting my site, so that they
instead see a message saying "Your IP has been banned, email me if
you think this is an error." I've *almost* got it working -- when
people visit URLs like
http://209.160.28.154/index.html
or
http://209.160.28.154/foo-does-not-exist
they see the "banned IP" message. However, the problem is that if
you try to access the front page:
http://209.160.28.154/
from a banned IP address, you see the "Apache Test Page for CentOS"
page, instead of seeing the "banned IP" message. Anybody recognize
this problem or have an idea of what could be causing it?
In my httpd.conf file, I changed "AllowOverride None" to
"AllowOverride All" in both the default <Directory /> tag and inside
the <Directory "/var/www/html"> tag -- I placed a modified copy of
httpd.conf at:
http://209.160.28.154/httpd.conf
and in /var/www/html I placed a .htaccess file containing these lines:
ErrorDocument 403 /banned_ip.php
order deny,allow
deny from 71.112.32.149
and restarted the server. (The page
http://209.160.28.154/banned_ip.php shows the message you're supposed
to see when connecting from a banned IP. 71.112.32.149 is my home
machine IP which I've "banned" for testing purposes.)
So like I said, that almost works, where
http://209.160.28.154/index.html gives the right error message, but
http://209.160.28.154/ does not. Any idea how to change is to that
all URLs under http://209.160.28.154/ will give the "banned IP"
message if connecting from a banned IP?
-Bennett
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
" from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org
Bennett,
Try this: http://www.blockacountry.com/.
It will generate the .htaccess for you, and you can build on it.
Thanks,
Daniel
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
" from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org