IIS重写模式与URL完全匹配



我已经运行了IIS7.5,我正在尝试匹配一个明确的URL。以下代码不起作用。

 <rule name="presid" stopProcessing="true">
    <match url="(.*)" />
        <conditions>
            <add input="{REQUEST_URI}" matchType="Pattern" pattern="http://www.example.com/presid" ignoreCase="true" negate="false" />
        </conditions>
    <action type="Redirect" url="http://www.example.net/presid" />
  </rule>

我也试过逃离这些时期:

http://www.example.com/presid

但这似乎也不起作用。如何使用IIS7.5匹配特定的完整URL?

这是有效的,但并不能完全达到我想要的效果:(.*)/presid,但我有一些图像:

http://example.com/images/presid/eee.jpg

我不希望该图像被重定向。

REQUEST_URI不包含主机名。

改为使用这个:

<add input="{REQUEST_URI}" matchType="Pattern" pattern="^/presid$" ignoreCase="true" negate="false" />

当我需要匹配一个准确的完整URL时,我使用了两个条件,一个用于主机,另一个用于其他条件,例如:

<add input="{HTTP_HOST}" pattern="www.yourdomain.com" />
<add input="{REQUEST_URI}" pattern="pages/yourpage.aspx" />

最新更新