You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Daniel Lopez <da...@rawbyte.com> on 2002/03/15 03:03:02 UTC

mod_rewrite

Any ideas on how to know in mod_rewrite if a request is coming from one of
the local IP addresses w/o explictly listing all of them?
I try:

RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
RewriteCond %{REMOTE_ADDR} !=%{SERVER_ADDR}

but the SERVER_ADDR line does not work because RewriteCond does not expands
anything in the second argument

Thanks

Daniel

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: mod_rewrite

Posted by Daniel Lopez <da...@rawbyte.com>.
Nope, if the machine has address 10.0.0.42 and I connect locally to a server
running at 10.0.0.42, the client (me) will appear as comming from 10.0.0.42,
not 127.0.0.1

If I connect to same server using 127.0.0.1, then, yes I will appear as
coming from 127.0.0.1 

> RewriteCond %{REMOTE_ADDR} !127\.0\.0\.
> is enough. it's a regexp, not a glob, so it should not extend to full 
> string. Also you may find RewriteMap and "RewriteOptions inherit" 
> useful.
> 
> îÁ 2002.03.15 04:03 Daniel Lopez ÎÁÐÉÓÁÌ:
> > 
> > Any ideas on how to know in mod_rewrite if a request is coming from
> > one of
> > the local IP addresses w/o explictly listing all of them?
> > I try:
> > 
> > RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
> > RewriteCond %{REMOTE_ADDR} !=%{SERVER_ADDR}
> > 
> > but the SERVER_ADDR line does not work because RewriteCond does not
> > expands
> > anything in the second argument
> > 
> > Thanks
> 
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: mod_rewrite

Posted by Daniel Lopez <da...@rawbyte.com>.
> ... and: you don't nee to escape the chars in the regexp.
> !127.0.0
> looks nicer...

It is a regular expression, you do need to escape the dots :)
An alternate way would be
!=127.0.0.1


> Artiom Morozov wrote:
> 
> > RewriteCond %{REMOTE_ADDR} !127\.0\.0\.
> > is enough. it's a regexp, not a glob, so it should not extend to full 
> > string. Also you may find RewriteMap and "RewriteOptions inherit" useful.
> >
> > îÁ 2002.03.15 04:03 Daniel Lopez ÎÁÐÉÓÁÌ:
> >
> >>
> >> Any ideas on how to know in mod_rewrite if a request is coming from
> >> one of
> >> the local IP addresses w/o explictly listing all of them?
> >> I try:
> >>
> >> RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
> >> RewriteCond %{REMOTE_ADDR} !=%{SERVER_ADDR}
> >>
> >> but the SERVER_ADDR line does not work because RewriteCond does not
> >> expands
> >> anything in the second argument
> >>
> >> Thanks
> >
> >
> > ---------------------------------------------------------------------
> > 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
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> 
> -- 
>                    http://www.meome.de
> -------------------------------------------------------
> Martin Haase-Thomas         |       Tel.: 030 43730-558
> meOme AG                    |       Fax.: 030 43730-555
> Software Development        |           mht@meome-ag.de
> -------------------------------------------------------
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: mod_rewrite

Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
... and: you don't nee to escape the chars in the regexp.
!127.0.0
looks nicer...

Artiom Morozov wrote:

> RewriteCond %{REMOTE_ADDR} !127\.0\.0\.
> is enough. it's a regexp, not a glob, so it should not extend to full 
> string. Also you may find RewriteMap and "RewriteOptions inherit" useful.
>
> îÁ 2002.03.15 04:03 Daniel Lopez ÎÁÐÉÓÁÌ:
>
>>
>> Any ideas on how to know in mod_rewrite if a request is coming from
>> one of
>> the local IP addresses w/o explictly listing all of them?
>> I try:
>>
>> RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
>> RewriteCond %{REMOTE_ADDR} !=%{SERVER_ADDR}
>>
>> but the SERVER_ADDR line does not work because RewriteCond does not
>> expands
>> anything in the second argument
>>
>> Thanks
>
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

-- 
                   http://www.meome.de
-------------------------------------------------------
Martin Haase-Thomas         |       Tel.: 030 43730-558
meOme AG                    |       Fax.: 030 43730-555
Software Development        |           mht@meome-ag.de
-------------------------------------------------------




---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: mod_rewrite

Posted by Artiom Morozov <ar...@phreaker.net>.
RewriteCond %{REMOTE_ADDR} !127\.0\.0\.
is enough. it's a regexp, not a glob, so it should not extend to full 
string. Also you may find RewriteMap and "RewriteOptions inherit" 
useful.

îÁ 2002.03.15 04:03 Daniel Lopez ÎÁÐÉÓÁÌ:
> 
> Any ideas on how to know in mod_rewrite if a request is coming from
> one of
> the local IP addresses w/o explictly listing all of them?
> I try:
> 
> RewriteCond %{REMOTE_ADDR} !127\.0\.0\.1
> RewriteCond %{REMOTE_ADDR} !=%{SERVER_ADDR}
> 
> but the SERVER_ADDR line does not work because RewriteCond does not
> expands
> anything in the second argument
> 
> Thanks

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org