0

如何/使用 IIS 重写重写站点的基本路径(即)?

到目前为止,我已经尝试过:

<rule name="RewriteIndexUrl" stopProcessing="true">
      <match url="/" />
      <conditions>
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
     <action type="Rewrite" url="index.html" />
</rule>

目前它没有重写该基本路径,而是index.html直接返回。

4

1 回答 1

0

我可以找出一个可能的解决方案并且它有效:

  1. 删除 IIS 站点中的所有默认文档(即index.html, index.htm, default.aspx...)

  2. 添加以下重写规则:

<rule name="RewriteIndexUrl" stopProcessing="true">
  <match url="^" />
  <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
  </conditions>
  <action type="Rewrite" url="index.html" />
</rule>
于 2014-10-06T16:08:26.373 回答