欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue下history模式刷新后404錯誤解決方法

 更新時間:2018年08月18日 14:13:07   作者:linvic  
這篇文章主要介紹了vue下history模式刷新后404錯誤解決方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

本文介紹了vue下history模式刷新后404錯誤解決方法,分享給大家,具體如下:

官方說明文檔:

https://router.vuejs.org/zh/guide/essentials/history-mode.html

一、 實測 Linux 系統(tǒng) Apache 配置:

更改站點配置文件即可,我這里在 Directory 標(biāo)簽后面添加了官方給的五行配置

<VirtualHost *:80>
  #Created by linvic on 2018-05-24
  Serveradmin 674206994@qq.com
  ServerName blog.xxx.com
  DocumentRoot /home/www/blog

  <Directory "/home/www/blog">
    Options FollowSymLinks
    AllowOverride All
    #Require all denied
    Require all granted
    RewriteEngine On
    
    RewriteBase /
    RewriteRule ^index\.html$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.html [L] 
    
  </Directory>
</VirtualHost>

二、 實測 Windows 環(huán)境下 IIS 配置

1. IIS安裝Url重寫功能

https://msdn.microsoft.com/zh-cn/gg192883.aspx

  • 到該網(wǎng)站下載安裝web平臺安裝程序
  • 安裝后打開到里面搜索安裝URL重寫功能

2. web.config

將web.config 文件放置于 npm run build 打包后文件的根目錄即可。

ps:此文件會自動給IIS上的URL重寫功能進(jìn)行相關(guān)配置

文件內(nèi)容如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <staticContent>
   <remove fileExtension=".woff" />
   <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
   <remove fileExtension=".woff2" />
   <mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
   <remove fileExtension=".ttf" />
   <mimeMap fileExtension=".ttf" mimeType="font/x-ttf" />
   <remove fileExtension=".json" />
   <mimeMap fileExtension=".json" mimeType="text/json" />
  </staticContent>
  <rewrite>
   <rules>
    <rule name="vue" 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>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論