Security & Protection2 min read•Updated September 2026

How to Ban Malicious IP Addresses via .htaccess on LiteSpeed

If you detect abusive crawling or attack traffic in your server access logs, you can instantly deny them access before PHP or WordPress executes.

Step-by-Step Instructions

1

Open your public_html/.htaccess file

Open File Manager in cPanel and edit your root .htaccess file.

2

Add Apache 2.4 / LiteSpeed Ban Rule

Insert the following block replacing the IP address with the offending IP or CIDR block:

<RequireAll>
    Require all granted
    Require not ip 198.51.100.1
    Require not ip 203.0.113.0/24
</RequireAll>
3

Save and Apply

LiteSpeed applies .htaccess changes instantly without restarting the server.

Related Guides in Security & Protection

How to Protect Your .htaccess File and Block Unauthorized Access

3 min read • Read →

How to Protect a Directory with Username & Password in cPanel

3 min read • Read →

How to Blacklist an IP Address Using cPanel IP Blocker

2 min read • Read →
Chat with HubforHost on WhatsApp (+91 7780204727)