httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scherler....@juntadeandalucia.es>
Subject [users@httpd] How to set environment variable from RewriteMap? (was Re: [users@httpd] mod_rewrite E flag does not set env. variable)
Date Mon, 10 Mar 2008 12:44:36 GMT
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@juntadeandalucia.es> 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@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