Url rewriting 将所有通信从URL1重定向到URL2,特定目录除外

Url rewriting 将所有通信从URL1重定向到URL2,特定目录除外,url-rewriting,iis-8,Url Rewriting,Iis 8,我需要做的是将所有通信量从URL1重定向到URL2,除非请求URI是/SECURE目录。除此之外,我还需要将URL1/特定目录中的任何内容重定向到URL2/特定目录 以下是我提出的两条规则,我正在排除故障 <rule name="Redirect to certain-directory" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="Matc

我需要做的是将所有通信量从URL1重定向到URL2,除非请求URI是/SECURE目录。除此之外,我还需要将URL1/特定目录中的任何内容重定向到URL2/特定目录

以下是我提出的两条规则,我正在排除故障

    <rule name="Redirect to certain-directory" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_URI}" pattern="^/certain-directory$" />
                    <add input="{HTTP_HOST}" pattern="^URL1$" />
    </conditions>
    <action type="Redirect" url="http://URL2/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Redirect from certain-directory" stopProcessing="false">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_URI}" pattern="^/$" negate="true" />
                    <add input="{REQUEST_URI}" pattern="^/certain-directory$" negate="true" />
                    <add input="{HTTP_HOST}" pattern="^URL2$" />
    </conditions>
    <action type="Redirect" url="http://URL1/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>

结果是我刚刚把请求的结尾搞错了。而不是

<add input="{REQUEST_URI}" pattern="^/certain-directory$" negate="true" />

我只是需要

<add input="{REQUEST_URI}" pattern="^/certain-directory" negate="true" />