Vue router with Wordpress

21 Views Asked by At

I'm creating a plugin with Vue for Worpdress, and having some issues. I'm using Vue Router and everything looks okay, until a nested route is not accessed directly. The problem is that nested Vue Route are not found (404) if accessed directly.

For example:

Main application stands in: myhost.com/auction

And I have a route for single page:myhost.com/auction/lot/{some_params}

So if I try to access myhost.com/auction/lot/{some_params} directly, wordpress tries to find page {some_params}, I need to ignore this behavior.

I tried with .htaccess but no luck. As I understand probably rules needs to be rewritten that everything after auction/ should go as request to auction/ and then router should work.

Here is my router:

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/auction',
      name: 'main',
      component: Main,
    },
    {
      path: '/auction/lot/:params',
      name: 'single',
      component: Single,
      props: true
    }
  ]
})

What I need that a nested route to be accessible directly.

0

There are 0 best solutions below