【发布时间】:2014-07-09 19:24:40
【问题描述】:
目前我的 web.config 中有一个重写规则,它删除了“.aspx”页面扩展名。
我想重写我的 URL 以删除整个页面名称“page1.aspx”,这样我的 URL 将显示为“www.mysite.com/folder/”而不是“www.mysite.com/folder/page1”
我目前使用的 web.config 中的重写代码如下:
<rewrite>
<rules>
<clear />
<rule name="Redirect to clean URL" enabled="true" stopProcessing="true">
<match url="^([._0-9a-z-/]+).aspx$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="RewriteASPX" enabled="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
</rules>
</rewrite>
我需要在当前规则中添加或编辑什么以获得所需的结果?
谢谢!
【问题讨论】:
标签: asp.net url-rewriting