Vue网站发布到iis后提示404页面不可访问

发布时间 2023-11-30 18:19:54作者: 邢帅杰
参考:https://www.cnblogs.com/yhnet/p/14804869.html
vue重定向和跨域配置:https://zhuanlan.zhihu.com/p/530688251
1.安装组件:
URL Rewrite:https://www.iis.net/downloads/microsoft/url-rewrite
Application Request Routing:https://www.iis.net/downloads/microsoft/application-request-routing
2.新建一个web.config 放到发布到文件夹根目录
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Handle History Mode and custom 404/500" 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>
</configuration>