我当前的网址看起来像:http://www.example.com/files/maps.html
我希望它看起来像:http://www.example.com/maps.html
[基本上,我只是想摆脱URL的“ / files /”部分。我正在使用IIS URL重写模块,但不熟悉它,也不熟悉reg表达式。
您可以尝试使用以下规则:
<rewrite>
<rules>
<clear />
<rule name="Removefoldername" stopProcessing="true">
<match url="^abc$|^abc/page1.html$" />
<conditions>
</conditions>
<action type="Redirect" url="page1.html" />
</rule>
<rule name="RewriteToFile">
<match url="^(?!abc/)page1.html" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="abc/page1.html" />
</rule>
</rules>
</rewrite>