Block Sites by IP

Open httpd.conf and set

AllowOverride All

restart apache web server

and create a .htaccess file on the directory you want to block by ip :

order deny,allow
allow from x.y.z.a
deny from all