我的IIS中有虚拟主机:
http://sampleserver.org
我想将此网址重定向到tomcat应用程序http://localhost:8081/one
但我不想要重定向网址
http://sampleserver.org/two
至http://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。
这是不可能还是我错过了什么?
答案 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>