Block a site visitor by IP
If you have a web site, you know that fight against bad spammers or a undesirable visitor (aggressive, insulting...) can be useful. The method to block a particular IP address is a bit the same that to get rid of sites which steal your images, with a .htaccess file. This is even more basic because this is a base function of .htaccess which does not need the Rewrite module, or any other.
Here is the code to put in your .htaccess file to block the IPs from 188.8.131.52 to 184.108.40.206:
Allow from all
Deny from 220.127.116.11
Deny from 18.104.22.168
Deny from 22.214.171.124
You can also block a visitor by his host name, by writing:
Deny from domain.com
but it requires that your server resolves domain name from IP addresses, that is generally deactivated because it consumes resources for a little utility, so this have less chance to work. If it works, that can be useful to ban spam servers which pollute your comments but with different IPs.
Hopefully if your server does not resolve addresses, you can get around this limitation by using IP ranges:
Deny from 1.2.5
Deny from 126.96.36.199 188.8.131.52
will block all IPs beginning by 1.2.5 and all the range between 184.108.40.206 and 220.127.116.11.
This is detailed in the Allow documentation of the Apache server. The different values are of course the same for the Deny command instead of Allow.