[Vuejs]-Vuejs nginx subdirectory deployment on refresh 404

0👍

I think u need a redirect for ‘/apps/login’ to ‘/apps’ in nginx.

For Vue, there is one page only, which is the root page (rest pages are generated by js). Although you see /apps/login, /apps/login.html or /apps/login.php do not actually exist. In other words, file /apps/dist/login.php(in your case, nginx run:try_files $uri $uri/ index.php; ) is not found. Therefore, it return 404.

Personally, I do not recommend to use history. It is too clumsy for building up the redirect path for these similar case. If you don’t want to handle that, use hash mode and utilize routes function in Vue.

Leave a comment