【发布时间】:2019-06-25 22:13:20
【问题描述】:
我想删除我的 html 扩展名,但在目录中使用时失败。 link1 我的网站工作正常,但其他目录链接不能正常工作。 link2
我想删除这个链接末尾的html扩展
但是在我重写之后
在 stackover flow other question 我找到了我的问题的解决方案,但它无法正常工作。
我在 web.config 文件中的解决方案是
<rewrite>
<rules>
<rule name="Hide .html ext">
<match ignoreCase="true" url="^(.*)"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<add input="{REQUEST_FILENAME}.html" matchType="IsFile"/>
</conditions>
<action type="Rewrite" url="{R:0}.html"/>
</rule>
<rule name="Redirecting .html ext" stopProcessing="true">
<match url="^(.*).html"/>
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).html"/>
</conditions>
<action type="Redirect" url="{R:1}"/>
</rule>
</rules>
</rewrite>
【问题讨论】:
标签: asp.net iis url-rewriting web-config