apache的配置
這是windows下的
在httpd-vhosts.conf文件中把目錄指向項目index.html文件所在的位置
# Virtual Hosts#<VirtualHost *:80>ServerName localhostDocumentRoot D:/wamp64/www/huanzuan/dist<Directory "D:/wamp64/www/huanzuan/dist">Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all</Directory></VirtualHost>
然后再 index.html文件的同級路徑下 創建.htaccess文件
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index/.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]</IfModule>
內容就是官方文檔給的 一點都不用改
然后確保 config/index.js中的build下的
assetsPublicPath: '/',是絕對路徑就可以了
以上這篇vue-cli 打包使用history模式的后端配置實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。
新聞熱點
疑難解答