7

I have a rewrite rule in my asp.net mvc app in config file:

<rule name="Website1" stopProcessing="true">
  <match url=".*" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="^(www.)?website1.com" />
      <add input="{PATH_INFO}" pattern="^/website1/" negate="true" />
     </conditions>
   <action type="Rewrite" url="\website1\{R:0}" />
</rule>

How does the rule work in this situation with two conditions? Both condition must be true?

1 Answer 1

19

Yes, both conditions must be true.

Rule Conditions

Conditions are defined within a collection of a rewrite rule. This collection has an attribute called logicalGrouping that controls how conditions are evaluated. If a rule has conditions, then the rule action will be performed only if rule pattern is matched and:

  • All conditions were evaluated to true, provided that logicalGrouping="MatchAll" was used.
  • At least one of the conditions was evaluated to true, provided that logicalGrouping="MatchAny" was used.

The Doc is not very clear about which logical grouping is to be used by default but I can say that it is MatchAll.

In other words, <conditions> is the same as <conditions logicalGrouping="MatchAll">.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.