There was a problem loading the comments.

How to Ban an IP Address Using .htaccess

Support Portal  »  Knowledgebase  »  Viewing Article

How to Ban an IP Address Using .htaccess

To deny a specific IP address from accessing your website, you can follow the guide below.

Click here for cPanel instructions.

Click here for DirectAdmin instructions.

 

Follow these steps to ban an IP address using your .htaccess in cPanel:

 

1. Log in to your cPanel account.
For instructions on how to log in to your cPanel account, please click here.

e67bc52bc40656261a64477d109e88c36200cd6ec44572d26e421abce763aa4abd741ae6f2174bef?t=16a6aeb0a7b17c76830f158aac1b2d47

 

2. Access the File Manager and navigate to the directory of the .htaccess file.
For instructions on how to access your .htaccess file, please click here.

 

3. Enter the code below into the .htaccess file, and replace "IP-ADDRESS" with the IP address you want to ban.

order allow, deny
deny from IP-ADDRESS
allow from all

 

4. Save the text file.

 

 

Follow these steps to ban an IP address using your .htaccess in DirectAdmin:

 

1. Log in to your DirectAdmin account.
For instructions on how to log in to your DirectAdmin account, please click here.

93fa78453a69c8622e20602c56d427ffbc75b0d076fae439ca797766e8b0a04e417dcdf46c774d2d?t=edf763a81977cd2c9a4f74c2f4d2f115

 

2. Access the File Manager and navigate to the directory of the .htaccess file.
For instructions on how to access your .htaccess file, please click here.

 

3. Enter the code below into the .htaccess file, and replace "IP-ADDRESS" with the IP address you want to ban.

order allow, deny
deny from IP-ADDRESS
allow from all

 

4. Save the text file.

Did you find this article useful?