Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- htaccess: Block IP range, but allow certain user agents within.


lucy24 - 11:34 pm on Dec 17, 2012 (gmt 0)


NOT able to use CIDR for IP's in mod_rewrite

Wasn't that one of the luscious additions in 2.4? Can't find it now, so I may have imagined it :(

mod_rewrite is the easiest-- in part because that's what most people around here are used to.

It could also be done in an ordinary Allow/Deny statement if you are in "Deny,Allow" order. Then you would Deny the bigger range and Allow the smaller range. But I don't think anyone hereabouts is brave enough to whitelist based solely on IP ranges.

It could be done in mod_setenvif if you do two pieces: first set the bigger range to keep_out = 1 (or whatever variable you use) and then reset the smaller range to keep_out = 0.

It's more difficult in mod_alias.

Your fingers typed "mod_alias" (simple Redirects) but I think your forebrain meant "mod_access" and/or "mod_authz_thingummy" depending on Apache version ;)


Thread source:: http://www.webmasterworld.com/apache/4529025.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com