Skip to content

How do I block an IP address from my website? Print

  • block, ip, htaccess, security
  • 23

You can stop specific IP addresses from reaching your website with a few lines in .htaccess.

  1. Open the File Manager and go to httpdocs.
  2. Open .htaccess (create it if it does not exist) and add:
    <RequireAll>
      Require all granted
      Require not ip 203.0.113.45
      Require not ip 198.51.100.0/24
    </RequireAll>
  3. Save the file. Blocked visitors get a "Forbidden" page.

Find addresses to block in your website logs.

Attackers change addresses constantly, so blocking one at a time rarely helps for long. If your site is under attack, open a ticket. We filter attacks at the server, and our security team can help with more.

Was this answer helpful?

« Back