ASP.NET/IIS7 Url重写映射不起作用

Are*_*ren 5 asp.net iis-7 url-rewriting

我按照说明学习IIS的网页,为我的asp.net应用程序添加了重写映射的静态重定向.

以下是配置:

<rule name="Redirect rule1 for Information" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{Information:{REQUEST_URI}}" pattern="(.+)" />
    </conditions>
    <action type="Rewrite" url="{C:1}" appendQueryString="true" />
</rule>
Run Code Online (Sandbox Code Playgroud)

<rewriteMaps>
    <rewriteMap name="Information">
        <add key="/Information/CorporateSales.aspx"
             value="/KB/Information/CorporateSales" />
        <add key="/Information/ComputerRepair.aspx"
             value="/KB/Information/ComputerRepair" />
    </rewriteMap>
</rewriteMaps>
Run Code Online (Sandbox Code Playgroud)

这甚至最初是由IIS管理器中的向导创建的,用于使用重写映射.

所以我的想法是/Information/CorporateSales.aspx- > /KB/Information/CorporateSales301重定向(永久移动).

但是我只是加载原始的aspx页面(我们将在以后删除).我甚至删除了文件,因为它默认为现有资源,并且我只是得到一个没有重定向的普通404.

有人有想法吗?

让我澄清一下:

重写模块工作,它已安装并运行.我的标准正则表达式规则运行良好.但我的重写地图却没有.

Jas*_*nce 7

本文http://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module和下面的代码为我工作.

<rewrite>
    <rules>
        <rule name="Redirect rule1 for RedirectURLs">
            <match url=".*" />
            <conditions>
                <add input="{RedirectURLs:{REQUEST_URI}}" pattern="(.+)" />
            </conditions>
            <action type="Redirect" url="{C:1}" appendQueryString="false" />
        </rule>
    </rules>
    <rewriteMaps>
        <rewriteMap name="RedirectURLs">
            <add key="/privacy.php" value="/privacy" />
        </rewriteMap>
    </rewriteMaps>
</rewrite>
Run Code Online (Sandbox Code Playgroud)


Ben*_*ing -5

您是否重置了应用程序池和 iis 站点?

在某些情况下,它可能需要长达 72 小时 (iirc) 才能在全世界传播。