Web Config Multiple Rewrite Rule

167 Views Asked by At

I am working on angularjs project. this project contains two index pages. I need to redirect to index1.html for the url domain/Admin/* or redirect to index2.html. i have the following rewrite rule in web config, this always redirect to index2.html.

    <rule name="Rule1" stopProcessing="true">
      <match url="^/Admin$" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/index1.html" />
    </rule>

    <rule name="Rule2" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/index2.html" />
    </rule>

  </rules>
</rewrite>

Whats wrong with this rule.please help me to find out the solution.

0

There are 0 best solutions below