You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sa...@seagate.com on 2004/08/20 07:08:04 UTC

[users@httpd] specifying a IP range in mod_rewrite

Hello All,

I have the following rewrite rule


RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4][2-7].* 
RewriteCond %{REQUEST_URI}       /web/* 
RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 

Will it cover all the IP address from 129.219.32.*   TO 129.219.47.* ?????

Thanks.
Saqib Ali
https://downloads.seagate.com

Re: [users@httpd] specifying a IP range in mod_rewrite

Posted by Rich Bowen <rb...@rcbowen.com>.
On Fri, 20 Aug 2004 Saqib.N.Ali@seagate.com wrote:

> > > RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4][2-7].* 
> > > RewriteCond %{REQUEST_URI}       /web/* 
> > > RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 
> > > 
> > > Will it cover all the IP address from 129.219.32.*   TO 129.219.47.* 
> ?????
> > 
> > No, it won't cover .40 or .41
> 
> 
> OK how about this?
> RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4]([2-7]|[0-1]).* 
> RewriteCond %{REQUEST_URI}       /web/* 
> RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 
> 
> Will this cover all the IP address from 129.219.32.*   TO 129.219.47.* 
> ?????

No. Not only will it cover 30 and 31, but it misses 38 and 39.
Perhaps something more like (3[2-9]|4[0-7])

-- 
And everyone said, "If we only live, 
We too will go to sea in a Sieve -
To the hills of the Chankly Bore!"
 (The Jumblies, by Edward Lear)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] specifying a IP range in mod_rewrite

Posted by Sa...@seagate.com.
> > RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4][2-7].* 
> > RewriteCond %{REQUEST_URI}       /web/* 
> > RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 
> > 
> > Will it cover all the IP address from 129.219.32.*   TO 129.219.47.* 
?????
> 
> No, it won't cover .40 or .41


OK how about this?
RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4]([2-7]|[0-1]).* 
RewriteCond %{REQUEST_URI}       /web/* 
RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 

Will this cover all the IP address from 129.219.32.*   TO 129.219.47.* 
?????


Thanks,
Saqib Ali
http://validate.sf.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] specifying a IP range in mod_rewrite

Posted by Sa...@seagate.com.
Hello Rich,

> No, it won't cover .40 or .41
> Regular expressions are character based. Your rule says to match things
> where the first character is 3 or 4, and the second character is between
> 2 and 7. Thus, 32-37 and 42-47.

Thanks for the reply. I guess I can write two rules, the sencond one to 
cover .40 and .41 . But is there a single rule that will work????

Thanks.
Saqib Ali
http://validate.sf.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] specifying a IP range in mod_rewrite

Posted by Rich Bowen <rb...@rcbowen.com>.
On Thu, 19 Aug 2004 Saqib.N.Ali@seagate.com wrote:

> Hello All,
> 
> I have the following rewrite rule
> 
> 
> RewriteCond %{REMOTE_ADDR}       ^129.219.[3-4][2-7].* 
> RewriteCond %{REQUEST_URI}       /web/* 
> RewriteRule  ^/web(.+)   http://www.eas.asu.edu/$1 [L] 
> 
> Will it cover all the IP address from 129.219.32.*   TO 129.219.47.* ?????

No, it won't cover .40 or .41
Regular expressions are character based. Your rule says to match things
where the first character is 3 or 4, and the second character is between
2 and 7. Thus, 32-37 and 42-47.

-- 
Rich Bowen - rbowen@rcbowen.com
Did I have the dream, or did the dream have me? (Rush - Nocturne)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org