history路由模式404报错的解决方法

方法一:

vue的官方文档里的Vue-Router插件

history.png

安装IIS UrlRewrite

image.png

项目打包目录dist 新建 web.config

目录i.jpg

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

方法二:

https://note.youdao.com/ynoteshare1/index.html?id=ffc354bb42f8dd9502a89f42c51c48af&type=notebook#/958092068FDE4846ADE975709E1EB433

这样你的history的404的问题就解决了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。