I have yii2+vue project and it works well except sub urls are first redirected from 404. My htaccess file looks as following:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Vue router :
router.beforeEach((to, from, next) => {
store.dispatch('auth/check')
.then(res => {
console.log(res);
if (to.path == '/login' && res.status) {
next('/')
} else if (!to.meta.guest && !res.status) {
next('/login')
} else {
next()
}
}, () => {
})
})
When I access any subpage, like http://domain/subpage, it shows 404 apache page first..after that redirects to content page managed by vue. Please help
its apache2 + yii issue not vue js issue router . check this Removing index.php from URL cause 404 in yii