当前位置: 移动技术网 > IT编程>脚本编程>vue.js > vue-cli 打包使用history模式的后端配置实例

vue-cli 打包使用history模式的后端配置实例

2018年10月07日  | 移动技术网IT编程  | 我要评论

巨巢,web qq下载,武动乾坤59

apache的配置

这是windows下的

在httpd-vhosts.conf文件中把目录指向项目文件所在的位置

# 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>

然后再 文件的同级路径下 创建.htaccess文件

<ifmodule mod_rewrite.c>
 rewriteengine on
 rewritebase /
 rewriterule ^index\.html$ - [l]
 rewritecond %{request_filename} !-f
 rewritecond %{request_filename} !-d
 rewriterule . / [l]
</ifmodule>

内容就是官方文档给的 一点都不用改

然后确保 config/index.js中的build下的

assetspublicpath: '/',是绝对路径就可以了

以上这篇vue-cli 打包使用history模式的后端配置实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网