dousou1878
dousou1878
2015-09-16 20:36
浏览 190
已采纳

Laravel 5.0 auth控制器无限重定向循环

I recently tried to change my

Route::controllers([
  'auth' => 'Auth\AuthController',
]);

to

Route::controllers([
  '/' => 'Auth\AuthController',
]);

however, I noticed that this puts the entire site into a perminant redirect loop to a single page when one logs in(if one logs out, the problem disappears). Can anyone explain to me why this is and how to get around this? I would like the auth routes in the root rather in auth/ if possible.

NOTE: The welcome and home controllers are both commented out so they cannot conflict.

Thanks.

图片转代码服务由CSDN问答提供 功能建议

我最近试图改变我的

  Route :: controllers  ([
'auth'=>'Auth \ AuthController',
]); 
   
 
 

   Route :: controllers([
'/'=>'Auth \ AuthController',
]); 
   
 
 

然而,我注意到了 当一个人登录时,这会将整个站点放入一个永久的重定向循环到一个页面(如果一个登出,问题就会消失)。 任何人都可以向我解释为什么会这样,以及如何解决这个问题? 如果可能的话,我希望在root中的auth路由而不是 auth /

注意:欢迎和家庭控制器都被注释掉,因此它们不会发生冲突。

谢谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyouzheng2209
    douyouzheng2209 2015-09-17 16:17
    已采纳

    I found the problem to be the ordering of routes. When I pulled up the route list, I noticed that the routes for auth included login/, logout/ and {_missing}. The {_missing} route was intercepting every other route call since it was declared before all of my other routes. Thus, since the {_missing} route uses the guest middleware, it redirected to the home.

    点赞 评论

相关推荐