解决Vue前端去掉#,与后台联调点击刷新会出现404

最近前端改为Vue.js,上线的时候发现这个“#”非常的难看,比如是https://www.luyouli.com/#/app,就想着把“#”去掉,变成https://www.luyouli.com/app。

本来很简单的事情,在前端妹纸改了之后发现刷新页面成了404了,几经周折研究最后发现需要改Nginx配置,修改配置如下:

Nginx下
# vim /app.conf
location / {
        try_files $uri $uri/ /index.html;
            }
# systemctl restart nginx

3 评论

  1. Excellent post. I was checking constantly this weblog and I am
    inspired! Extremely helpful info specifically the ultimate section 🙂 I maintain such info much.

    I was looking for this particular information for a long time.
    Thank you and good luck.

留下评论

error: Content is protected !!