apache的配置
这是windows下的
在httpd-vhosts.conf文件中把目录指向项目index.html文件所在的位置
# Virtual Hosts # <VirtualHost *:80> ServerName localhost DocumentRoot 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模式的后端配置实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持北冥有鱼。
您可能感兴趣的文章:
- 详解如何将 Vue-cli 改造成支持多页面的 history 模式
- Vue-cli配置打包文件本地使用的教程图解
- 解决vue-cli项目打包出现空白页和路径错误的问题
- Vue下路由History模式打包后页面空白的解决方法
- nginx部署访问vue-cli搭建的项目的方法
- 在nginx上部署vue项目(history模式)的方法