Skip to content

Instantly share code, notes, and snippets.

@netnr netnr/web.config

Created May 17, 2020
Embed
What would you like to do?
IIS 重写 URL,移除 .html 后缀,依赖 URL Rewrite
<!-- web.config -->
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteHTML">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
<!--URL Rewrite 下载地址:https://www.iis.net/downloads/microsoft/url-rewrite -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.