iprangeblockediirf

IIRF Allow Specific IP's in a blocked range


I have a range of IP addresses that are blocked. But I have 3 ip addresses within this block that need to be allowed. Can anyone help with this? The Rewrite rule looks like this:

RewriteCond %{HTTP_true_client_ip} 54\.(242|243|234|235|236|237|224|225|226|227|208|209|210|211|221|204|205|196|197|198|80|81|82|83|84|85|86|87|88|89|90|91|92)\.\d{1,3}\.\d{1,3}
RewriteRule ^(.*)$ $1 [F]

I want to allow these three [54.243.53.243, 54.243.53.248, 54.198.174.172] which are currently blocked. Any help would be appreciated. I am not sure how to rewrite this. Thanks


Solution

  • I was able to add this code to omit specific IPs in the range above:

    RewriteCond %{HTTP_true_client_ip} ^(?!54\.243\.53\.243) 
    RewriteCond %{HTTP_true_client_ip} ^(?!54\.243\.53\.248)
    RewriteCond %{HTTP_true_client_ip} ^(?!54\.198\.174\.172)
    

    Tested and it works, no problems.