2015-10-21 06:00 阅读 67

Laravel-5在登录后点击浏览器重定向到/ home

I have read this: Laravel-5 redirecting to /home after login

and in AuthController I have set

protected $redirectPath = '/user/info';

and after login it gets to this page. But when clicking browser back button - it does for some reason go to /home url.

Why is that? Previous page should be login page.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • drwg89980 drwg89980 2015-10-21 06:08

    Fixed problem in hacky way:

    Route::get('/home', function () {
        // fix after log in when user clicks back - it wants to redirect to not existing home page
        return redirect('/my-existing-page');
    点赞 评论 复制链接分享
  • dsflxcfuw27742248 dsflxcfuw27742248 2015-10-23 09:08

    Are you using the default middleware RedirectIfAuthenticated.php? If so, that is what is redirecting you - it checks if you are authenticated (which you are, since you just logged in) and redirects to "/home". For whatever reason, the "/home" path is hardcoded there.

    点赞 评论 复制链接分享