Blocking and Unblocking IP Addresses
DirectAdmin provides tools to block specific IP addresses from accessing your hosting account. This is useful for preventing brute-force attacks, stopping spammers, or restricting unwanted traffic to your website.
Blocking an IP Address via .htaccess
The most common way to block IPs at the website level is through the .htaccess file in your public_html directory:
# Block specific IPs
order allow,deny
deny from 192.168.1.100
deny from 10.0.0.0/24
allow from all
For Apache 2.4+ syntax:
<RequireAll>
Require all granted
Require not ip 192.168.1.100
Require not ip 10.0.0.0/24
</RequireAll>
Using DirectAdmin's IP Deny Manager
- Log in to DirectAdmin and go to Advanced Features → IP Deny Manager (also listed under the domain settings area).
- Enter the IP address or CIDR range you want to block (e.g.,
192.168.1.100or10.0.0.0/24). - Click Add to apply the block.
Unblocking an IP Address
- Navigate to the same IP Deny Manager page.
- You will see a list of currently blocked IPs.
- Select the IP address you wish to unblock.
- Click Remove Selected or Delete.
Server-Level Blocking (Admin Only)
Server administrators can use the firewall (CSF/LFD or iptables) to block IPs at the network level, which is more effective than .htaccess blocks because the connection is refused before the web server processes the request. If you are experiencing a sustained attack, contact your hosting provider to apply server-level blocks.
Checking Your IP
Before blocking IP ranges, verify your own IP by visiting a service like whatismyip.com to ensure you do not accidentally block yourself.