vue-cli 打包使用history模式的后端配置实例
更新时间:2018年09月20日 14:19:36 作者:暮木_
今天小编就为大家分享一篇vue-cli 打包使用history模式的后端配置实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
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+elementui+vuex+sessionStorage实现历史标签菜单的示例代码
本文主要介绍了vue+elementui+vuex+sessionStorage实现历史标签菜单的示例代码,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2021-12-12


最新评论