• Wednesday, February 25, 2026

Knowledge Base

How to Block IP Addresses in DirectAdmin

Blocking Unwanted Visitors

Block specific IP addresses from accessing your website.

Using .htaccess

Add to your .htaccess file:

Block a Single IP

Deny from 123.45.67.89

Block Multiple IPs

Deny from 123.45.67.89
Deny from 98.76.54.32

Block an IP Range

Deny from 123.45.67

(Blocks 123.45.67.0 - 123.45.67.255)

Block Everyone Except Specific IPs

Order deny,allow
Deny from all
Allow from 123.45.67.89

Finding Problematic IPs

  1. Check your access logs in DirectAdmin
  2. Look for unusual patterns (too many requests, suspicious URLs)
  3. Note the IP addresses

Blocking by Country

For country-level blocking, you may need to use a service like Cloudflare or install a security plugin.

Important Notes

  • Blocking IPs only affects web traffic, not email
  • Some attackers use multiple IPs
  • Consider using a Web Application Firewall for better protection