vue-cli 打包 使用 history模式 的后端配置
2018-01-08 16:15
921 查看
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:
'/',是绝对路径就可以了
这是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配置打包文件本地使用的教程图解
- vue +vue-cli+vue router ,npm run build 打包完页面空白,不显示URL的#号router模式为history
- 使用Vue-cli打包,dist目录内的index.html文件双击使用浏览器打开报错
- Vue-cli创建项目从单页面到多页面2-history模式
- vue-cli 打包时抽离项目相关配置文件
- servlet中使用vue-router history模式&前端配置记录
- vue.js使用vue-cli打包遇到的坑,问题
- vue 跨域:使用vue-cli 配置 proxyTable 实现跨域问题
- 基于vue-cli 打包时抽离项目相关配置文件详解
- 使用vue-cli打包过程中的步骤以及问题
- vue cli引入微信sdk,完成微信接口调用——使用natapp配置本机ip映射(三)
- 在Mac中使用vue-cli搭建的vue框架,下载到win7环境中,配置应该注意的问题
- phpstorm中使用xdebug配置cli模式的调试
- 使用Vue-cli搭建多页面应用时对项目结构和配置的调整
- 在 vue-cli 脚手架中引用 jQuery、bootstrap 以及使用 sass、less 编写 css [vue-cli配置入门]
- Vue2 Vue-cli中使用Typescript的配置详解
- vue-cli dev模式下图片路径配置 和build下图片路径的配置
- 基于vue-cli的vue项目之axios的使用6--配置axios
- vue-router的history模式发布配置