Banning IPs using .htaccess

May 10, 2010 | By

One of the many features the file .htaccess provides for a website is the ability to ban IP addresses or ranges of IP addresses from accessing it. This could be useful when a spambot, scrapper or leecher is consuming your bandwidth.

I’ve created an IP Ban Generator tool to create the <Limit GET POST> section of the .htaccess file automatically. This section lists who is allowed and denied access to the website. To use the tool just enter the list of IP addresses in the textbox seperated by line breaks and check the checkbox if you’d like to prevent visitor from accessing the .htaccess file with their browsers. You could enter a specific IP address, for example 10.0.0.2 or 192.168.20.20; and enter the first 3 octets of the IP address, for example 10.0.0. or 192.168.20., to ban the whole range. Using 192.168.20.20 and 10.0.0.2 as an example of IPs to ban, the <Limit GET POST> section should look like this:

Filed in: Announcements, Online Tools, Web Development | Tags: , , ,

Comments are closed.