vue3.* 使用二級目錄部署


 

1、vue.config.js 里將publicPath設置成二級目錄

 

 

2、router.js 里 設置二級目錄( * vue3里使用createRouter)

 

 

 

 

 3、服務器配置

  apache: 

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

 

nginx:

location ^~/path{
alias /path;
try_files $uri $uri/ /path/index.html;
index index.html;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM