vue-router下的html5 history在iis服务器上的设置 vue去掉#

转自:https://www.cnblogs.com/zzsdream/p/6576639.html

1.安装 url rewrite模块到IIS

下载地址

2.在web.config文件中 system.webServer 节点添加如下配置(如果没有,自行添加一个Web.config)

  <system.webServer>
    <!--rewrite 节点,用于支持history模式-->
    <rewrite>
      <rules>
        <rule name="API Rule" stopProcessing="true">
          <match url="^(api|account|manage)(.*)$" />
          <action type="None" />
        </rule>
        <rule name="Angular Rule" stopProcessing="true">
          <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="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
原文地址:https://www.cnblogs.com/feigao/p/9103406.html