Hosting - Guide e FAQ search
clear

How to block an IP using .htaccess

If you need to block an IP address to access your website, you have to type a rule in your .htaccess file.

For example, to block the IP  192.168.10.10, you have to open the .htaccess file, with a text editor via FTP or using the Documents Management from cPanel, and type:
order allow,deny
deny from 192.168.10.10
allow from all 

You can also block multiple IPs or an entire range of addresses, typing:
order allow,deny
deny from 66.249.74.0/24
allow from all

In this case, all the IPs from 66.249.74.0 to 
66.249.74.255 will be blocked.

You can also choose to ensure access for specific IP addresses and block all the others. This may happen in case you need to work on your website after an hacking attack, blocking all external IPs apart yours, to avoid new attacks and to remove all the infected files and update the installation as fast as you can. In these conditions, you will need to type: 
order allow,deny
allow from 185.17.106.200
deny from all

To guarantee the highest level of security and protection from malware and hacking attacks to your website, we invite you to visit our Linux Hosting and VPS pages, to choose the right solution for your needs. 

 

 

Did you find this answer helpful?

Still need help?

Contacts

Contacts

Request information, assistance or quotes

Chat

Chat

Ask about services and promotions

Ticket

Ticket

Submit a request for technical support

Payments

Payments

Make a payment in a few clicks