httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noah <s...@onastick.net>
Subject Re: [users@httpd] mod_rewrite
Date Fri, 29 Jul 2005 17:47:49 GMT
On Fri, Jul 29, 2005 at 12:49:00PM -0400, Lucas, David wrote:
> Hello,
> 
> I have an interesting dilemma that I need to figure out a solution to.
> I hope someone on this list can help me.
> 
> I have Apache running on a Linux server.  I need to change the document
> root based on source IP address.  I have this working and it works very
> well.  Now, with the nature of a couple of our subnets I'm not sure how
> to go about it.  This is one that is working:
> 
> RewriteEngine on
> RewriteCond %{REMOTE_ADDR} (^10\.10\.41\.[0-9]|^10\.10\.49\.[0-9])
> RewriteRule ^(.*) /blocked/$1
> RewriteCond %{REMOTE_ADDR} (!^10\.10\.41\.[0-9]|!^10\.10\.49\.[0-9])
> RewriteRule ^/blocked/(.*) /$1

[snip]

> How would I make apache change the document root for 10.10.224.128 -
> 10.10.224.254 to the blocked location but if you have a source IP of
> 10.10.224.56 then you would get the registration page which is located
> in /var/www/html??

The following regex which match 10.10.224.128 - 10.10.224.254:

^10\.10\.224\.(1(2[89]|[3-9][0-9])|2([0-4][0-9]|5[0-4]))$


...is that more or less what you needed?

--n

-- 
Neil! Your bed's on fire!

---------------------------------------------------------------------
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


Mime
View raw message