homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

IP ranges in .htaccess
Jordo needs a drink

 5:56 am on Mar 16, 2007 (gmt 0)

Can you block ip ranges in the .htaccess like

deny from ###.###.###.### - ###.###.###.###?

I thought you could, but I have ip's accessing a site, that are in the range I blocked.



 8:17 am on Mar 16, 2007 (gmt 0)

Yes you can, but not using that format. Search for "CIDR" or "netmask".


 11:50 am on Mar 16, 2007 (gmt 0)

Details on how to do so can be found in the Apache manual pages under the Allow [httpd.apache.org] directive.


 12:00 pm on Mar 16, 2007 (gmt 0)

I don't mean to take this off track, but blocking a range of IP's, if for the long term, is much more efficiently handled in IPtables (or your firewall if this is a Windows server).



 2:47 pm on Mar 16, 2007 (gmt 0)

> off track

... but most Webmasters are on shared virtual hosting, and have no access to IPtables, firewalls, or anything beyond the limited .htaccess controls -- Which is why we do a big business here in .htaccess issues, and relatively little in server config discussion.

As stated above, the documentation for the Allow directive in mod_access enumerates the various methods for specifying IP address ranges.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved