首页 > 其他 > 详细

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

时间:2018-11-14 20:09:15      阅读:128      评论:0      收藏:0      [点我收藏+]

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: '/',

是绝对路径就可以了

原文地址:https://segmentfault.com/a/1190000012750025

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

原文:https://www.cnblogs.com/lalalagq/p/9959890.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!