How To Ban IPs Or Domains From Accessing A Directory
If you wish to dissallow a certain user from accessing your forum or one of
your scripts, you can use an .htaccess file to ban them from accessing anything
in a certain directory. Please note that this only applies to your
CGI Server at cgi.yourdomain.com where yourcomain.com represents
your actual domain name. This is not for use on your web server where your
regular web pages exist.
Create a file called htaccess.txt using a plain text editor. In the file, put these lines:
Allow from all
Deny from 000.000.00.00 somedomain.com
Change the Deny from line's bold IP and domain to the IP numbers or domains you want to ban. You can leave out portions of this and what will be banned is anything starting with the text you put in this line. For example:
Deny from 123.456.78
Will disallow access from anyone who's IP address starts with 123.456.78 and that would be including IP addresses such as 123.456.78.01, 123.456.78.200 or whatever number is after 123.456.78. Nobody with IP numbers beginning with those numbers will be allowed to access any scripts or data in the directory this .htaccess file is placed. This works for partial domain names too, such as domain.com or just do (which would ban domain.com, do-do.com, and any domain name starting with a "do").
If you would like to change the file to add or remove an IP or domain, change the file you created on your hard drive (ie. htaccess.txt for example), delete the .htaccess file from your CGI server and upload the new htaccess.txt, renaming it to .htaccess after you upload it. For more information, see How To Make Changes Or Delete An .htaccess File.