Control Panel

Learn How To Block IPs Using htaccess File

In this article, we will learn how to block IPs using htaccess file.

You may block access to your website from specific IP addresses using .htaccess file.
You need to create this file in your public_html or httpdocs directory and add these following lines:

order allow,deny
deny from 127.0.0.1
allow from all

These lines will block access for all users using 127.0.0.1 IP address.

If you need to block a group of IP addresses. use these example lines:

order allow,deny
deny from 127.0.0.1/24
allow from all

These lines will block access for all IP addresses within the 127.0.0.1/24 subnet.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles