1

These days I read a very interesting post about the precedence of [OR] over the implicit [AND]. I really liked the original question as well as highly appreciated answer.

I just recently stumbled upon further problems concerning this topic.

The problems start as soon as you try to express the following:

RewriteCond A
RewriteCond B
RewriteCond C
RewriteRule ...

with A OR (B AND C). Where ever you place the [OR], it won't work:

#resolves to (A OR B) AND C
RewriteCond A [OR]
RewriteCond B
RewriteCond C
RewriteRule ...

#resolves to A AND (B OR C)
RewriteCond A
RewriteCond B [OR]
RewriteCond C
RewriteRule ...

#makes no sense at all with no further cond after c
RewriteCond A
RewriteCond B
RewriteCond C [OR]
RewriteRule ...

It doesn't get better with more RewriteCon, since you'll always need a 'partner' to pair the [OR] with :( My finding was that

You can only express RewriteCond-sets that come from the CNF (conjunctive normal form).

Which, imho, is pretty huge and caused by the lack of an explicit [AND] as well as no possiblity to bracket two Cond together.

PLEEEEASE correct me if I'm wrong, I really hope that I just missed something! Not that you can always code more than one rule to satisfy your needs, but this has really been bugging me, since I had a real user-case where that was needed.


TL;DR

The second you try to express

(block of 'n' ANDs) OR X
# with n > 0
# and X being a random logical expression (or in rewrite-terms: Rewrite-Cond set)

you just can't with current set of logical operators ([OR],!)

Community
  • 1
  • 1
Hello Fishy
  • 729
  • 5
  • 16

0 Answers0