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.
有人有想法吗?
让我澄清一下:
重写模块工作,它已安装并运行.我的标准正则表达式规则运行良好.但我的重写地图却没有.
本文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)
| 归档时间: |
|
| 查看次数: |
12419 次 |
| 最近记录: |