Banning an IP with .htaccess file

No AccessSometimes there are situations where you would like to ban an IP to stop the misuse of your site and its services. So here is a technique for banning an IP with the help of .htaccess file.
You will have to create an empty .htaccess file or use an existing one on server if it is already overthere.The code to ban an IP with .htaccess file.

order allow,deny
deny from ###.###.###.###
allow from all

You can replace the # with the IP which needs to be banned.

To ban multiple IP’s use the following code

order allow,deny
deny from ###.###.###.###
deny from ###.###.###.###
deny from ###.###.###.###
deny from ###.###.###.###
allow from all

Where the # can be replaced by the IP which needs to be banned from your server.

The above code is free to use but author of this site is not responsible for anything that might go wrong. Use it at your own risk.

If you have cpanel on your hosting server then IP Deny Manager would be easier to use.