Re: 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 Tue, 2008-03-11 at 13:20 +0100, Krist van Besien wrote:
> On Tue, Mar 11, 2008 at 12:29 PM, Thorsten Scherler
> <thorsten.scherler.ext@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> >  To overcome that problem I took your suggestion and combined it like:
> >  RewriteCond ${portadaboja:boletin}      ^(.+)$
> >  RewriteCond  %{REQUEST_URI} /%1
> >
> >  but that is never got hit.
> >
> >  What I actually trying is to compare the REQUEST_URI with the map entry.
> >  Is this possible and I am just not using it the right way?
> 
> If you are trying complicated things with rewrite rules it always is a
> good idea to have a rewritelog, with a high enough loglevel. this will
> show you a lot of what is happening.

I have 
RewriteLogLevel 3

> Now, what is not entirely clear is what you are trying to do. You want
> to look something up in a map and compare it with the requested URL,
> right? 

Totally.

> That is going to be complicated. 

hehe, yeah, I started to notice. ;) 
Thanks for sticking with me.

> In the example you gave above,
> are you just using RewriteCond's ? 

Yeah, the next line is
RewriteRule  ^(.*)  %{DOCUMENT_ROOT}$1
[E=FOCUS:true,E=REWRITEMAP_RESULT:%1,L]

> You are aware that a "RewriteCond"
> statement only gets evaluated if the following RewriteRule matches?

Ah, I thought it is the other way around.

> Can you maybe just describe what it is you are trying to achieve?
> Maybe there is a simpler way.

I really hope there is. ;)

I am creating the new version of http://andaluciajunta.es/BOJA. The
current version is a dynamic J2EE app and the next version is completely
based on static html pages (generated by Apache Forrest) that are using
some ssi for common parts.

The common parts are:
- header
- footer
- left menu

Now the left menu will be changed in the new version to just a couple of
points. The most important for our use case are:
- Último boletín (last bulletin)
- Boletines anteriores (older bulletins)

The interesting code snippet is the following:
<li>
 <a accesskey="U" href="/BOJA">Último boletín</a>
</li>
<li>
 <a accesskey="F" class="actual"
href="/boja/boletines/index.html">Boletines anteriores</a>
</li>

You see the second li has a class="actual" that produces a
presentational highlight. Now all bulletins share the same left.ssi.html
but the last (most recent) bulletin should highlight the first li and
not the second.

The most recent bulletin is defined a redirect.txt that is changed with
every new bulletin (will be generated each day). To prevent to generate
two different ssi for the left menu I wanted to use something like:
<!--#if expr="test_condition" -->
<!--#else -->
<!--#endif -->
to either highlight the first or the second.

Like you noticed I am trying to compare the REQUEST_URI with the result
of the map entry ${portadaboja:boletin}. If they are the same I would
like to set FOCUS=true (where FOCUS=test_condition).

We started with that the R flag which I need to use since the trigger
url (.../BOJA) HAS TO be rewritten to the latest bulletin
(e.g. /boletines/2008/1/index.html) will produce another request. 

Now I am trying to compare the requested url with the one from the
rewriteMap to decide which points needs to be highlighted.

Hopes that makes the use case and the requisition clearer.

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