How to block IP or Domain in cPanel

The steps below will allow you to un-access visitors from a specific IP Address or Domain Name. The easiest way is to do this through your cPanel. You can also do so by editing your .htaccess file in your directory.

IP block of cPanel:

  1. Login to your 'cPanel'.

  2. Under "Security", select the "IP Blocker" menu.

  1. Under 'Add an IP Deny:' enter the IP address or Domain name that you want to block from accessing your site.

  1. Click “Add”

IP block using the .htaccess file:

If you want to block ip with .htaccess add the code below to your .htaccess file:

order allow,deny

deny from

deny from

allow from all

The first line tells .htaccess what you want to specify. The second and third lines will invalidate a single IP or Domain name. The fourth line allows access to others.

If a banned visitor tries to access the specified location (where the .htaccess file is located), they will see a 403 Forbidden Access Error Page.


To remove an IP ban, all you need to do is delete the string in your .htaccess file or choose from the drop down menu on the IP Deny Manager page.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.