How to block an IP address on your website
Sometimes one address causes trouble: spam through a contact form, repeated login attempts or a scraper using up bandwidth. You can block it in a few minutes from cPanel.
Find the address first
In cPanel, open Metrics » Visitors or Raw Access to see which IP addresses are reaching your site and what they are requesting. Copy the address you want to block.
Block it with IP Blocker
- Log in to cPanel and open Security » IP Blocker.
- Enter a single address (203.0.113.10), a range (203.0.113.10-203.0.113.50) or a CIDR block (203.0.113.0/24).
- Click Add. The block applies to your website straight away.
To remove a block, delete the entry from the same page.
Block it in .htaccess
If you prefer to edit files, add these lines to the .htaccess file in your website's folder:
<RequireAll> Require all granted Require not ip 203.0.113.10 </RequireAll>
Put each part on its own line, and keep a copy of the file before you change it.
Before you block
- Attackers change addresses often, so blocking one IP rarely stops a determined attack. Our servers already run Imunify360 and brute-force protection that block most of this automatically.
- Do not block a whole range unless you are sure no real visitors use it.
- Blocking stops access to your website. It does not stop email sent from that address.
On Windows hosting
On our Windows plans, IP restrictions are set in the site's web.config file or in Plesk. Our support team can help if you are unsure.
Frequently asked questions
Short answers to common questions
Still have a question?
Send us a message and we will point you to the right plan.
Hosting with security built in
Imunify360, brute-force protection and daily backups on every cPanel plan.