
当在 vue 应用中使用路由/article,并且后端 nginx 也有/article路由时,刷新页面后可能会导致页面跳转到其他位置。这是因为 nginx 拦截了刷新请求,并将其重定向到自己定义的/article路由。
解决方法:
nginx 配置示例:
立即学习“前端免费学习笔记(深入)”;
location / {
root /path/to/html/;
try_files $uri $uri/ /index.html =404;
}注意:
以上就是Vue路由与Nginx路由冲突怎么办?的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号