@Ozan check your namespaces.
Feb 13, 2015
28
Level 32
Route Redirect Loop Problem
Hey, I am having a redirection loop problem. Please help me out.
Route::group(['prefix' => 'blog', 'namespace' => 'Blog'], function()
{
Route::get('/', ['as' => 'blog.home', 'uses' => 'PostsController@index']);
Route::resource('posts', 'PostsController');
Route::resource('tags', 'TagsController');
Route::resource('comments', 'CommentsController');
Route::resource('likes', 'LikesController');
});
I go to this url: ozankurt.dev/blog
And I get redirect loop error from chrome.
Here is my Controller and Repository:
class PostsController extends Controller {
private $postRepository;
function __construct(PostRepository $postRepository)
{
$this->postRepository = $postRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
dd($this->postRepository->getAllPaginatedWithTagsAndOwners(5));
return view('blog.pages.home')
->with('posts', $this->postRepository->getAllPaginatedWithTagsAndOwners(5));
}
}
class DatabasePostRepository implements PostRepository
{
public function getAllPaginatedWithTagsAndOwners($postsPerPage)
{
return Post::with(['owner', 'tags'])->paginate($postsPerPage);
}
}
Level 65
So it's a slash problem. Probably related to htaccess or Nginx rewrite. Do you have an admin folder?
Related to the 301 redirect in the htaccess for trailing slash (when a directory exists).
Please or to participate in this conversation.