All shared, reseller, and semi-dedicated hosting plans allow you to block individual IPs or entire ranges of IPs from accessing your sites. There are two ways to complete this:
Blocking IPs through cPanel
- Login to your accounts cPanel at https://yourdomain.com/cpanel
- Use the provided search to look for the IP Blocker interface:
- Enter the IP address you wish to block in the provided form and then click Add:
- Your blocked IP will now display under the "Currently-Blocked IP Addresses" interface:
Blocking IPs through .htaccess
Alternatively you can modify your .htaccess file to block IPs. Your .htaccess file is usually found in the document root directory of your website:
To block a single IP, add the following to the top of your .htaccess file. Replace 1.2.3.4 with the IP you wish to block:order allow,deny
deny from 1.2.3.4
allow from all
To block multiple IPs, add the following to the top of your .htaccess file. Replace 1.2.3.4, 5.6.7.8, 9.10.11.12, etc. with the IPs you wish to block:order allow,deny
deny from 1.2.3.4
deny from 5.6.7.8
deny from 9.10.11.12
allow from all
To block an entire range of IPs, add the following to the top of your .htaccess file. Replace 1.2 with the start of the full range you wish to block:order allow,deny
deny from 1.2
allow from all