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

apache的配置html

這是windows下的apache

在httpd-vhosts.conf文件中把目錄指向項目index.html文件所在的位置windows

# 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文件ide

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

內容就是官方文檔給的 一點都不用改ui

而後確保 config/index.js中的build下的code

assetsPublicPath: '/',

是絕對路徑就能夠了htm

相關文章
相關標籤/搜索