我有yii2 + vue项目,它运作良好,除了首先从404重定向子URL。我的htaccess文件如下所示:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Vue路由器:
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()
}
}, () => {
})
})
[当我访问任何子页面时,例如http://domain/subpage,它将首先显示404 Apache页面。在此之后,该页面将重定向到vue管理的内容页面。请帮助
其apache2 + yii问题不是vue js问题路由器。检查这个Removing index.php from URL cause 404 in yii