31 December 2010

How to block an IP using htaccess

Sometimes you need to block an IP which is doing DOS (Denial Of Service) or DDOS (Distributed Denial Of Service) attack on your site. For this purpose I am sharing a simple htaccess code. You just need to place this code in your htaccess file and the attacking IP will be blocked from your site.
##########BLOCKING AN IP################
< Limit GET HEAD POST>
order allow,deny
deny from XXX.XXX.XXX.XXX
allow from all
< /LIMIT>
########################################

For any queries and problems feel free to comment and don’t forget to replace “XXX.XXX.XXX.XXX” with the IP address that you want to block in the above code.

No comments: