If you are seeing repeated abusive traffic, login attempts, or scraping from a specific address, you can block it at the server level so it never reaches your website at all. Both control panels offer a simple tool for this that does not require editing server configuration files directly.
In cPanel
- Log in to cPanel and open IP Blocker under the Security section.
- Under Add an IP or Range, enter the address you want to block. You can enter a single address like 203.0.113.5, a range like 203.0.113.1-203.0.113.20, or a CIDR block like 203.0.113.0/24.
- Click Add.
- The blocked entry appears in the list below, where you can remove it later by clicking Delete next to it.
In DirectAdmin
- Log in to DirectAdmin and open IP Blocking under the Advanced Features or Extra Features section, depending on your server's menu layout.
- Enter the IP address or range you want to block in the input field.
- Click Add IP or Save to apply it.
- To unblock later, select the entry from the blocked list and remove it.
Finding the IP address to block
You can usually find the offending address in your website's raw access logs (available in cPanel under Raw Access Logs, or via your site's analytics if it logs visitor IPs) or in error notifications if you use a security plugin on your CMS. Confirm the address is actually causing the problem before blocking it, since a shared IP used by a proxy or mobile network could also be blocking legitimate visitors.
IP blocking is best for a small number of specific bad actors. If you are dealing with large-scale automated attacks from constantly changing addresses, a web application firewall or your CMS's login-attempt limiting (for example a login lockdown plugin on WordPress) will do more than blocking addresses one at a time.