Deny visitors by IP address in .htaccess

The Allow and Deny directives let you allow and deny access based on the host name, or host address, of the machine requesting a document. The Order directive goes hand-in-hand with these two, and tells Apache in which order to apply the filters. These are very useful for blocking unwanted access, or to restrict access to certain sections of the website. For example:

order deny,allow
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
allow from all