nginx / router deep URLs not working on server #10079
Unanswered
adamprocter
asked this question in
Help/Questions
Replies: 1 comment
-
this is my answer, it may be helpful https://stackoverflow.com/a/79302293/17601704 In vue router 4 for vue3 firsttry to find the mounted APP.vue, when you refresh the webpage, the App.vue will be loaded firstly. So make sure you don't mounted mounted() {
this.$router.push("/");
} the correct thing mounted() {
this.loading();
},
methods: {
loading() {
if(document.URL=="http://localhost:9000/" || document.URL=="https://zoujiu.com.cn/"
|| document.URL=="http://zoujiu.com.cn/" || document.URL=="http://localhost:9000/#/"
|| document.URL=="http://zoujiu.com.cn/#/"|| document.URL=="https://zoujiu.com.cn/#/"
) {
this.$router.push({ path: '/'});
}
}
} deploymentI use this history with nginx ssl https const router = createRouter({
// history: createMemoryHistory(),
history: createWebHashHistory(),
// history: createWebHistory(),
routes:constantRoutes,
}) developmentI use this history const router = createRouter({
// history: createMemoryHistory(),
// history: createWebHashHistory(),
history: createWebHistory(),
routes:constantRoutes,
}) this is myown website http://zoujiu.com.cn. |
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
-
I have an app that with localhost works great when visiting various routes but I always hit a 404 when I try to run it on my CentOS box, everything else works as expected but I cannot visit the longer URL route direct as I can local host and as I want
http://localhost:5173/partone/parttwo - works
but when on https://subdomain.myserver.com/partone/parttwo - gets a 404
I have added this as an NGINX route
Any tips would be much appreciated - do I need to more in the router stuff
This is the Router
Beta Was this translation helpful? Give feedback.
All reactions