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