IIS ARR规则。匹配所有但是

时间:2015-01-13 12:36:49

标签: iis rules arr

我的IIS中有虚拟主机:

http://sampleserver.org

我想将此网址重定向到tomcat应用程序http://localhost:8081/one

但我想要重定向网址

http://sampleserver.org/twohttp://localhost:8081/one/two

所以我的规则看起来像这样:

<rule name="Root zu Client" enabled="true" patternSyntax="ECMAScript" stopProcessing="false">
  <match url=".*" ignoreCase="false" negate="false" />
  <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
    <add input="{REQUEST_URI}" pattern="^two" negate="true" />
  </conditions>
  <action type="Rewrite" url="http://localhost:8081/one/{R:0}" logRewrittenUrl="true" />
</rule>

我想将除^two之外的所有内容重定向到tomcat。

这是不可能还是我错过了什么?

1 个答案:

答案 0 :(得分:1)

Pattern is not correct. If you don't want redirect url like http://sampleserver.org/two you must apply this:

  <rule name="RuleTWO" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*" />
        <conditions>
            <add input="{REQUEST_URI}" pattern="*/two*" negate="true"/>
        </conditions>
        <action type="Rewrite" url="http://localhost:8081/one/{C:2}" />
    </rule>