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: '/',
是绝对路径就可以了
来源: http://www.bubuko.com/infodetail-2846980.html