|  Home   |  Forums   |  News   |  Blog   |  Reviews   |
 Satellite   Digital TV   IPTV   Cable   HDTV   Computers   Apple   Games   Mobile Phones   Broadband   Internet   Security   Telecoms   USB   VoIP   Wireless   Science 

May 28, 2008

How to block spam IPs with htaccess

Bookmark and Share

by Brian Turner

There are a number of reasons why you may want to block certain IP’s from blocking your site.

Firstly, certain IPs are commonly used for spam (blogs or forums). Others may be used by bots which are trying to run functions of your site in such a way as to crash it.

Either way, there is a simple way any webmaster running a LAMP server (Linux, Apache, MySQL, PHP) can block these IP’s directly themselves - using .htaccess.

Simply add the following lines to the .htaccess file in the root of your public_html folder:

order allow,deny
deny from 24.27.124.14
deny from 54.21.15.
allow from all

Already I’ve included two sets of IPs to help illustrate how to use this.

The first line - deny from 24.27.124.14 - tells the server to block access from the single IP 24.27.124.14.

The second line - deny from 54.21.15. - tells the server to block access for all IP’s within the range of 54.21.15.0 - 54.21.15.255.

It’s as simple as that.

Story link: How to block spam IPs with htaccess


Discuss this in the Techwatch Forums



Special offers on iPhones

Related news to "How to block spam IPs with htaccess"




No Comments »

No comments yet.

Leave a comment

Connect with Facebook


Previous: «
Next: »

Visited 864 times, 2 so far today