← Back to Security & SSL

How to Set Up IP Blocking

IP blocking prevents specific IP addresses or ranges from accessing your website. Use it to stop known attackers, scrapers, or unwanted visitors.

Using cPanel's IP Blocker

Go to Security > IP Blocker in cPanel. Enter one or more IP addresses or ranges to block. Formats accepted:

  • Single IP: 1.2.3.4
  • Range: 1.2.3.1-1.2.3.100
  • CIDR: 1.2.3.0/24

Click Add to apply the block immediately.

Blocking via .htaccess

For more granular control, add to .htaccess:

Order Allow,Deny\nAllow from all\nDeny from 1.2.3.4\nDeny from 5.6.7.0/24

Blocking via Cloudflare

If using Cloudflare, you can block IPs, countries, or user agents from Security > WAF > Tools in the Cloudflare dashboard. Cloudflare blocks at the network edge β€” the request never reaches your server, saving bandwidth.

Was this article helpful?

On This Page