Dave, we’ve got a problem. I help run a Web site and we’re finding that there’s one troll out there (yes, I read your article on trolls a few days ago!) who keeps showing up and posting inflammatory comments, really ruining the guest book for everyone else. Is there a way to selective block one person without just tossing the whole guestbook out?
Sorry to hear about your problems, but it doesn’t entirely surprise me. For all that we as a society talk about free speech and the right to disagree, it only seems to extend in one direction: “You need to listen to me and you can’t shut me up.”
For you to be able to accomplish what you want — a tactic I endorse, by the way, and do not see as censorship in other than the most general way — you’re going to find that the solution varies based on what kind of Web server you have running.
A good first step, therefore, is to ask your Web hosting provider what kind of server they run. A good answer is Apache, because it’s flexible and easily tweaked to accomplish this task. If you have something else, like Microsoft’s Internet Information Server (aka “IIS”), you’ll need their help setting this up, because the solution I’m offering is Apache-specific.
If you are running Apache, then go into the directory that contains the guest book (or that contains the CGI script itself, for that matter) and, in a file called .htaccess, add the following:
<Directory /what/ever> Order Allow,Deny Allow from all Deny from 10.1.2.3 </Directory>
Switch “/what/ever” to match the directory name. That should do it. If that doesn’t work, you can also drop this block into your httpd.conf file, if you’re comfortable editing that file.
Once it’s installed, you’ll want to change the 10.1.2.3 to the IP address of the offending party (look in your log files for that information).
Hope this helps you solve the problem. Good luck.
My thanks to Omar W. Hannet for his help with this entry. Please pop over to the Apache Web site for more details on mod_access