Failed to router for MPA with history mode #2217
Unanswered
cn-ryh
asked this question in
Help and Questions
Replies: 1 comment
-
You need to configure the server to still return the index.html page: https://router.vuejs.org/guide/essentials/history-mode.html#Example-Server-Configurations |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am developing a multi-page application that uses vue-router4 history mode for routing. When I use
npm run serve
, the access is normal. However, when I uselive- server
orhttp- server
to access the buildeddist
folder, for pages that do not have secondary routing (for example, access tolocalhost:8081/login
can be accessed normally), but for those pages with secondary routing (such aslocalhost:8081/user/1
), It shows CANNOT FOUND /user/1 occurs.Obviously this is because there is no access to the routing program at all.
It is worth mentioning that when I use hash (for example,
localhost:8081/user/#/1
), multi-level routing can be accessed normally.Here is my code of router in
user
dictory.Beta Was this translation helpful? Give feedback.
All reactions