You will need to log into your Linux server directly using SSH. If you are not familiar on how to do this, we have articles on how to implement this on both Windows and Mac.
To create the .htaccess file, you need to create a text file with any Linux editor. The file must be called .htaccess and it must exist in the root directory of the website you want to deny access to.
In the file, there is a specify format you must adhere to. To block both single IP's and IP ranges, you must include the following;
order allow,deny - The rule set
deny from 192.168.1 - IP you want to block
deny from 24.0.0.0/23 - IP Range you want to block
Please note to block an IP Range, you must know the subnet.
You can also specify a deny all and allow rule set as well;
order deny,allow - The rule set
deny from all - Deny access from all IP's.
Allow from 192.12.4.1 - IP you want to allow.
An example of a file blocking IP address 1.2.3.4 and a subnet 2.0.x.x is below:
order allow,deny
allow from all
deny from 1.2.3.4
deny from 2.0.
0 comments:
Post a Comment