httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@aci.on.ca
Subject [users@httpd] mod_rewrite - Problem with syntax on rule
Date Wed, 23 Jun 2004 22:08:37 GMT
I hope someone could help me with a syntax issue I have on one of my rules
(at least I think its a syntax issue)

Here is a copy of what I currently use in my httpd.conf

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLoglevel 99
RewriteLog /var/log/rewrite_log
RewriteMap      hosts-redirect
txt:/usr/local/apache/conf/hosts.redirect
#RewriteCond   ${hosts-redirect:%{REMOTE_ADDR}|NOT-FOUND}
!=NOT-FOUND
RewriteCond   %{REMOTE_ADDR}    ^192\.168\.168\.[2-254]$
RewriteRule ^/.* http://www.example.com/ [R,L]
</IfModule>

What I am trying to do is take IP's in a class C (in this case
192.168.168.0/24) and redirect them to another site.

Now the commented out RewriteCond rule does work just fine IF I place each
IP in the file.

Example of my hosts-redirect txt file:

192.168.168.2 -
192.168.168.3 -
192.168.168.4 -

etc etc

That does work just fine.

The second RewriteCond does not work.  Here is a snipet from my
rewrite_log:

192.168.168.2 - - [23/Jun/2004:21:21:25 +0000]
[10.10.10.10/sid#80b6034][rid#80e0d24/initial/redir#1] (4)
RewriteCond: input='192.168.
168.2' pattern='^192\.168\.168\.[2-254]$' => not-matched --


As you can see it is attempting to match the exact string in my
RewriteCond line, I can only assume this is a syntax issue.  The
mod_rewrite doc has a similar example for host deny as that line so I
assumed that is valid syntax when I wrote it, obviously I am missing
something.

Help list!

Thanks for your time.

Jeff

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