How to Blacklist an IP Address to Deny It Access to Your Website
Evans
Last Update 2 месяца назад
For cPanel Users
Log in to your cPanel account
Go to the Security section
Click on “IP Blocker.”
Add the IP or IP Range
Under "Add an IP or Range", enter the IP address or range you want to block.
Click on “Add”
cPanel will now deny access to that IP.
Single IP Address: 192.168.0.1
Range: 192.168.0.1-192.168.0.40
Short Range: 192.168.0.1-40
CIDR Format: 192.168.0.1/32
Once added, any visitor from that IP or range will be blocked from accessing your website.
For DirectAdmin Users
DirectAdmin doesn't have a dedicated GUI tool like cPanel for IP blocking via browser, but you can achieve the same result by editing your .htaccess file or firewall configuration.
Log in to DirectAdmin
Go to File Manager
- Navigate to: File Manager > domains > yourdomain.com > public_html
Edit the .htaccess file
If the file doesn’t exist, create a new one.
Add the following lines:
Method 2: Using CSF (for server admins with root access and CSF firewall installed)
Log in to SSH as root
Add IP to deny list:
3. Restart CSF if necessary:
That's it! The blocked visitors should now see a 403 Forbidden error or be denied access completely.