Blocking IP addresses (IP Blocker and .htaccess) Print

  • IP Blocker, htaccess, Sicherheit
  • 0

If a specific IP address repeatedly attacks your website or causes unwanted traffic, you can block it. Conversely, you can restrict an area such as the admin login to your own IP address.

Block an IP address with IP Blocker

  1. Log in to cPanel.
  2. In the Security section, click IP Blocker.
  3. Under Add an IP or Range, enter the IP address or range and click Add.

Possible formats: single IP 192.0.2.10, range 192.0.2.10-192.0.2.40, CIDR 192.0.2.0/24. To remove a block, click Delete in the list.

Block an IP address via .htaccess

In the File Manager, add the following lines to public_html/.htaccess and replace the example IP:

Order Allow,Deny
Deny from 192.0.2.10
Allow from all

Allow a directory only for specific IPs

To protect the WordPress admin, for example, create the file wp-admin/.htaccess with the following content and enter your own IP address:

Order Deny,Allow
Deny from all
Allow from 192.0.2.10

Note: Your current IP address is shown in cPanel on the right under General Information. Many internet connections receive a new IP regularly. Make sure not to lock yourself out, and make a copy of the .htaccess file before changing it.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution