Re: Problem when mixing RewriteRules and <Location> directives

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

 



Why don't you just do it this way:

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

and solve your rewrite problem?


On Thu, Mar 22, 2012 at 5:22 AM, Bruno Tréguier <Bruno.Treguier@xxxxxxx> wrote:
Le 21/03/2012 à 12:57, Igor Cicimov a écrit :

Lets see ... why is mod_rewrite called mod rewrite? Probably because it
rewrites something and that something is the url.

Well, as strange as it might seem to you, I had figured that out myself, you see. ;-)



So you need to catch
what ever you need before it gets rewritten by mod_rewrite. And in your
case the Location comes too late ...

Ok for the Location statement behaviour. But what about the REQUEST_URI variable ? Why is it modified by the rewriting process (or so it seems) ?

If it weren't the case, at least the "SetenvIf" scheme should work, but it doesn't... So I tried to debug that, by using a header that I called "X-Debug".

Here is the conditional setting of the "X-MyTraceHeader" header:

SetenvIf REQUEST_URI "/onlinestore/checkout.*" CheckingOut=1

Header Add X-MyTraceHeader "CheckingOut" env=CheckingOut

And here is the X-Debug header:

Header add X-Debug "REQUEST_URI=%{REQUEST_URI}e CheckingOut=%{CheckingOut}e"

The output is really strange:

X-Debug: REQUEST_URI=/onlinestore/checkout/cart/updatePost/ CheckingOut=(null)

So, the X-Debug header shows that the REQUEST_URI variable is correctly set, its value *should* have triggered the SetenvIf condition and subsequently set the "CheckingOut" variable, which obviously is not the case. I also checked by eliminating the regular _expression_ on the SetenvIf line, putting the whole path, but the behaviour is the same.

This is really puzzling me. Any explanation, anyone ?


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.Treguier@xxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
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