How to set environment variable from RewriteMap? (was Re: mod_rewrite E flag does not set env. variable)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2008-03-10 at 13:12 +0100, Thorsten Scherler wrote:
> On Mon, 2008-03-10 at 11:20 +0100, Krist van Besien wrote:
> > On Mon, Mar 10, 2008 at 9:58 AM, Thorsten Scherler
> > <thorsten.scherler.ext@xxxxxxxxxxxxxxxxxxx> wrote:
> > > Hi all,
> > >
> > >  I am trying to use the E flag in some of my rewrite rules but without
> > >  suggest.
> > >
> > >  I have following configuration:
> > >  RewriteMap portadaboja txt:/opt/datos/httpd/redirect.txt
> > >  RewriteRule "^/BOJA$"
> > >  "http://%{HTTP_HOST}/boja/${portadaboja:boletin}"; [E=FOCUS:true,R]
> > >
> > >  The redirect works fine but when I use in my ssi the following:
> > >  <!--#set var="focus" value="$FOCUS" -->
> > >  1. <!--#echo var="focus" -->
> > >  2. <!--#echo var="FOCUS" -->
> > >  3. <!--#echo var="%{ENV:FOCUS}" -->
> > >
> > >  The out put is:
> > >  1. 2. 3. (none)
> > >
> > >  I am using apache2 as package from Ubuntu (2.2.3-3.2ubuntu2.1).
> > >
> > >  Can somebody explain me what I am doing wrong?
> > 
> > You are doing a redirect. Which means that after the rule matches the
> > client gets a response and starts a _new_ request. The apache  process
> > handling this new request does not have access to environment
> > variables set in a previous request.
...
> Thanks very much Krist for this explanation. So I need to find a
> workaround.

I changed the R flag to a L flag and that is working just fine however
that is not solving my problem, since I depending on a rewrite of the
url.

I need to know whether there have been a rewrite or the value of
${portadaboja:boletin} in my ssi for presentational reasons. 

As a workaround I tried:

RewriteMap portadaboja txt:/opt/datos/httpd/redirect.txt
SetEnv FOCUS ${portadaboja:boletin}

but the variable will the return the literal context. Meaning
${portadaboja:boletin} and not the result of this expression.

Does somebody has an idea how I can save either whether a rewrite had
happened or the result of the rewriteMap expression.

TIA for any ideas.

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux