Loading

IIS部署VUE刷新404问题如何解决?

新建Web.Config文件,写入以下内容,将文件放入到dist根目录中的。 

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

注意:记得重启一下IIS服务,方可生效。

posted @ 2022-03-31 17:34  Roc-xb  阅读(42)  评论(0)    收藏  举报

易微帮源码


易微帮官网