Hello there,

I presently have a problem when trying to mix RewriteRules and <Location> directives. I searched the list archives but didn't find anything similar to my situation. Let's try to be synthetic. Here are the relevant config directives:

At "VirtualHost" level, among other things, here are the RewriteRules I'm using:

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

This set of RewriteRules are used with an online payment solution called "Magento". The idea, rather classical, is that the file "index.php" is a catch-all script, dealing with any URI which is not included in the exceptions above (typically, media files that are served "statically", or files really existing on the underlying filesystem).

So far, so good.

Now, what I want to do is add certain headers depending on the Request URI. Here is how I thought I could do it:

<Location /onlinestore/checkout>
  Header Add X-MyTraceHeader "CheckingOut"
</Location>

But it doesn't work, the header is never present in the server response... However, if I use the same method with a URI corresponding to a *real* file (e.g. a media file), so that the RewriteConds prevent the RewriteRule from being executed, it works perfectly !

So, it seems that the URI (held in the env. variable REQUEST_URI) is rewritten "in place" by the RewriteRule, meanwhile it's the one that is used by <Location> directive as well !

I tried another method, quite similar, via mod_setenvif:

SetenvIf REQUEST_URI "/onlinestore/checkout" CheckingOut=1
Header Add X-MyTraceHeader "CheckingOut" env=CheckingOut

But to no avail.

Any idea or pointer ?

Thanks in advance !

Best regards,

Bruno

--
- Service Hydrographique et Oceanographique de la Marine  -  DMGS/INF
-  13, rue du Chatellier -  CS 92803  - 29228 Brest Cedex 2, FRANCE
-     Phone: +33 2 98 22 17 49  -  Email: bruno.tregu...@shom.fr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to