How to keep a bad visitor out of your site, and how to stop other websites from showing your images and eating your bandwidth.
Block an IP address
- In cPanel open IP Blocker.
- Enter a single address such as
203.0.113.7, a range, or a CIDR block such as203.0.113.0/24. - Click Add. The blocked list is shown below, and you can remove entries from there.
Find the address in Visitors or Raw Access under Metrics. Do not block your own address by mistake. A lot of real attackers rotate addresses, so for long lists a different approach is better.
Blocking whole countries
cPanel cannot block by country. If your domain uses Cloudflare (Using Cloudflare with your hosting), add a firewall rule there to block or challenge a country.
Stop hotlinking
- Open Hotlink Protection and click Enable.
- Check that your own domains, with and without
www, are in the allowed list. - Keep the extensions you want to protect, typically
jpg, jpeg, gif, png, bmp. - Tick Allow direct requests so people can still open an image by its address, and click Submit.
If it doesn't work
- Your own images disappeared: your domain, with or without
www, is missing from the allowed list. - Social networks stopped showing your preview image: add their domain to the allowed list.
- Hotlinking still happens: the other site may be loading a cached copy. Check again later, or open a ticket (Opening a support ticket that gets answered quickly).