I thought my syntax below would work great to allow IP Ranges using an asterix as the wildcard, but no joy…
Any idea what would work here?
My IP changes the last two batches of numbers….
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^112.*.*.*$
#RewriteRule ^(.*)$ - [R=403,L]
RewriteRule ^(.*)$ https://www.example.com/denied.html
</IfModule>
2
Answers
The IP matching regex was incomplete. It was looking for an IP of 112 followed by zero to three dots. That would obviously never happen.
This would work
By stripping the last part you would now match any address starting with 112 followed by a dot. This is pretty broad in what it could match. But should be enough for your purpose.
A more complete version would be this, where you specify the complete address.
This code snippet should work for you
Could you please try following. Considering that you don’t want to allow any IP starting from
112
then we can keep it simple regex. We need NOT to mention any other digits here since you are not concerned about it.