Block ip range using htaccess

by LPChip   Last Updated September 11, 2019 11:04 AM - source

I'm looking for a good way to block an entire IP range using htaccess.

The problem I'm having is that the block I need to ban is 100 IP ranges big. From a programmers perspective it should be easily doable, but I'm failing to get it done without adding 100 lines in my htaccess, and other techniques I tried did not work.

The IP Address range I need to block is for HUAWEI Clouds: 159.138.100.* - 159.138.199.*

A keen eye spots that basically 159.138.1 is enough to block.

I tried the following without success:

Order Allow,Deny
Deny from 159.138.1
Allow from all

I also tried:

Order Allow,Deny
Deny from 159.138.1*
Allow from all

How can I block this iprange effectively using .htaccess?



Related Questions


Why can't a network access our site?

Updated April 19, 2015 20:01 PM

htaccess - Blocking IPs - Hidden and / or spoofing(?)

Updated January 08, 2019 04:04 AM

Trigger IP ban based on request of given file?

Updated October 31, 2017 19:04 PM

Having Difficulty Blocking Spam Website Visitors

Updated August 20, 2015 17:01 PM

Godaddy ip canonicalization

Updated April 11, 2016 08:01 AM