[Vuejs]-Vue router in sub folder config in Laravel

0👍

in vue.config.js file add this line to module.exports

  publicPath:'/wt/',

this is htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /wt/index.html [L]
</IfModule>

this is router config

let router = new Router({
    base: '/wt',
    mode: 'history', // https://router.vuejs.org/api/#mode
    linkActiveClass: 'active',
    scrollBehavior: () => ({y: 0}),
    routes: configRoutes(),
});

Leave a comment