1

I'm using Laravel 4 pagination, and want to remove the page=1 and serve the default string instead; for example:

http://domain.com/search-results/

instead of

http://domain.com/search-results/?page=1

Of course, for page >=2, it's just fine to leave:

http://domain.com/search-results/?page=2
jOpacic
  • 9,453
  • 12
  • 36
  • 58

1 Answers1

2

Currently Laravel will always default to showing ?page=1.

Accomplishing what you want (always defaulting to not showing ?page=1) involves a mix of extending/using your own Presenter and/or also by using a custom Pagination view.

Stock pagination views are here, but you can create your own and define it within the view.php config.

In my blog, I do similar. My pagination view is here. You can see it loads in a custom Presenter class.

Note that my blog may not be up to date with latest Laravel code, but that should get you on your way to making the edits you need to do to accomplish that.

You may be able to skip code altogether and use a server configuration to redirect - That link assumes Apache.

Community
  • 1
  • 1
fideloper
  • 12,213
  • 1
  • 41
  • 38