Home > Software design >  Is there way to route to home from a separate app hosted in a sub directory?
Is there way to route to home from a separate app hosted in a sub directory?

Time:12-01

I have a vue js webapp which is hosted in www.example.com/app and the home page of the application is hosted in www.example.com as a separate vue js app using nginx. whenever the user hits, www.example.com/app/home I want to redirect to www.example.com.

right now I am doing,

//router.js 
{
      path: "/home",
      beforeEnter(to, from, next) {
        window.location.href = "https://www.example.com";
      }
    },

inside the route.js of example.com/app to achieve this. But in the localhost and the dev environment, this method won't work for obvious reasons. Is there a more convenient way to do this?

CodePudding user response:

I think you can redirect with relative URL.

window.location.href = "/";
  • Related