【问题标题】:Yii2+ vue project, subpages are redirected from 404Yii2+ vue项目,子页面从404重定向
【发布时间】:2020-03-26 16:38:17
【问题描述】:

我有 yii2+vue 项目,它运行良好,除了子 url 首先从 404 重定向。 我的 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 管理的内容页面。请帮忙

【问题讨论】:

    标签: apache vue.js yii2 router history


    【解决方案1】:

    它的 apache2 + yii 问题不是 vue js 问题路由器。检查这个 Removing index.php from URL cause 404 in yii

    【讨论】:

    • 谢谢,但我已经设置了 AllowOverride All,但它无济于事
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    • 1970-01-01
    相关资源
    最近更新 更多