homepage Welcome to WebmasterWorld Guest from 54.197.19.35
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
'Deny'-ing a Range of IP addresses
mel the snowbird




msg:4500260
 3:47 pm on Sep 26, 2012 (gmt 0)

HI:
I'm a newbie on this forum,
I run my three very small web sites from my home office using Apache 2.2.22 as my server.

I wish to 'deny' access to one of my sites to a *range* of addresses:

I have:

Order allow,deny
Allow from All
Deny from nnn. xxx.yy. ppp.qq.ss.tt etcetera

But, I wish to 'Deny' a *range* of IPs, e.g.,
Deny from nnn. (a Whole Region)
but 'allow' a certain few of the IPs in this region to be allowed.

In my dreams:
deny from nnn. Except for nnn.mm. AND. nnn.ppp.qq.ss AND etcetera

Can anyone tell me how to specify a Range of Denials please ?

Thanks,
-Mel Smith

 

wilderness




msg:4500262
 3:57 pm on Sep 26, 2012 (gmt 0)

Here's a simple example:


RewriteEngine on
#deny acces Class a EXCEPT excluded (!) ranges
RewriteCond %{REMOTE_ADDR} ^137\.
RewriteCond %{REMOTE_ADDR} !137\.118\.232\. [OR]
RewriteCond %{REMOTE_ADDR} !137\.119\.
RewriteRule .* - [F]

mel the snowbird




msg:4500270
 4:17 pm on Sep 26, 2012 (gmt 0)

HI Wilderness:

I've never used (or had to use) the RewriteEngine. So, I'll have to read up on it to understand the syntax.

Thanks for the response

Now, I'll dig into the documentation.

-Mel Smith
Alberta, Canada

wilderness




msg:4500281
 4:48 pm on Sep 26, 2012 (gmt 0)

FWIW mod_rewrite

mel the snowbird




msg:4500283
 4:53 pm on Sep 26, 2012 (gmt 0)

Hi Wilderness:
I've printed out a bunch of docs from apache.org on mod_rewrite and examples, and will read/study them today.

Thanks for the guidance !

-Mel Smith

wilderness




msg:4500607
 12:59 pm on Sep 27, 2012 (gmt 0)

mel,
FWIW, I don't comprehend the entire mod_rewrite and/or Apache docs and I've used portions for more than a decade.

There are hundreds of examples of UA and IP restrictions

RewriteCond %{REMOTE_ADDR} [google.com]

There are many, many more examples for RewriteCond %{HTTP_USER_AGENT} [google.com]

mel the snowbird




msg:4500795
 6:58 pm on Sep 27, 2012 (gmt 0)

Hi Wildernes:
Yeh, I printed out a whole bunch of docs from Apache.org and was lots almost immediately (I'm only a very primitive user of Regex).

Bur, I went to your examples (especially, 'Deny and Redirect an IP) and will look over it carefully -- in the privacy of my bedroom :))

Thanks AGAIN,

-Mel Smith
Edmonotn, Canada and Mesa, Arizona

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