Laravel 5 route pagination url encoding issue Laravel 5 route pagination url encoding issue laravel laravel

Laravel 5 route pagination url encoding issue


It looks to me like your issue is happening because the paginator is appending a trailing slash with some odd redirect (not sure if you guys are using custom htaccess). Example, if you search for e, this is the URL:

http://podobri.eu/search?query=e

However, the URL for the second page is this:

http://podobri.eu/search/?query=e&page=2

Notice the slash in front of ?query. If you remove the slash, it works. So, how can you fix this?

This was actually fixed a few months ago. You can see this commit here: https://github.com/laravel/framework/commit/806fb79f6e06f794349aab5296904bc2ebe53963

So, if you are using L5.1 or 5.2, you can run composer update, and it'll fix itself. However, if you are using 5.0, it seems like it still has this bug so you can use the setPath method and try this instead:

{!! $problems->setPath('')->appends(Request::except('page'))->render() !!}


I had a similar problem and my solution was changed the method of the route.

Route::post('uri', 'Controller@function')    ->name ('view.function');

for:

Route::any('uri', 'Controller@function')    ->name ('view.function');

It's works for me.

Regards and good luck.