If you notice a specific IP address repeatedly trying to hack your site, spamming, or scraping content, you can block them at the server level.
Method 1: Using cPanel's IP Blocker (Easiest)
-
Log in to your cPanel.
-
In the "Security" section, click on "IP Blocker."
-
In the "IP Address or Domain" field, enter the IP address you want to block.
-
You can block a single IP:
192.168.1.1 -
Or a range:
192.168.1.(this blocks 192.168.1.0 to 192.168.1.255)
-
-
Click "Add."
Anyone trying to access your site from that IP will now see a "Forbidden" error.
Method 2: Using .htaccess (Manual)
For advanced users who want more control:
-
Go to File Manager >
public_htmland edit the.htaccessfile. -
Add the following lines:
<RequireAll> Require all granted Require not ip 192.168.1.1 Require not ip 192.168.1. </RequireAll>
Method 3: Using a Firewall Plugin (WordPress)
Plugins like Wordfence have a "Live Traffic" feature where you can see all visits and instantly block suspicious IPs with one click.