Blocking IP Addresses

Although this can also be done via the cPanel administration menu, you may choose to edit the .htaccess file yourself if you need to block an IP address from accessing a directory on your site, place the following into an .htaccess file located in the directory you wish to block their access from:

Order Allow,Deny
Allow from all
Deny from 111.111.111.111

Replace 111.111.111.111 with the IP you wish to block.

If you need to block more than one ip:
Order Allow,Deny
Allow from all
Deny from 111.111.111.111
Deny from 222.222.222.222

or:

Order Allow,Deny
Allow from all
Deny from 111.111.111.111 222.222.222.222


If you wish to deny access to an entire block of IPs, only give a portion of the IP:
Order Allow,Deny
Allow from all
Deny from 111.111

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Turning off directory listings

So you don't want people seeing all the files you have in a directory when you don't have an...

Custom error pages without cPanel

If you're looking to create custom error pages the old fashioned way (editing the .htaccess file...