liunx下用jexus运行vue单页面站点HTML5 History 模式刷新页面404的解决方法

iis下是安装IIS UrlRewrite

然后在web.config 文件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>

结果如图

还有其他的如nginx等的配置可查看官网https://router.vuejs.org/zh/guide/essentials/history-mode.html

此文章记录的是jexus的配置方法如下
找到站点对应的配置文件取消rewrite的注释加上正则.* /

保存之后重启jexus即可.

猜你喜欢

转载自www.cnblogs.com/wuyubing/p/10876632.html