如何使用IIS重写重写基本路径(即“/”)?

如何使用IIS重写重写基本路径(即“/”)?,iis,url-rewriting,iis-8.5,Iis,Url Rewriting,Iis 8.5,如何重写站点的基本路径,即/使用IIS重写 到目前为止,我已经试过了: <rule name="RewriteIndexUrl" stopProcessing="true"> <match url="/" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add i

如何重写站点的基本路径,即/使用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。

我找到了一个可能的解决方案,它成功了:

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

添加以下重写规则:

<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>