In my local environment i did $items = Model::paginate(10);
and it worked. Then i pushed it to production and when i click on the pagination links it displays page 1 again and again. then i did dd($items)
. i found that the current Page
property of length aware pagination
is not changing when i change the address to /items?page=*
. How to make current page property change accordingly or there is some thing else? thanks in advance
Asked
Active
Viewed 1,207 times
4

Ahmed Nawaz Khan
- 1,451
- 3
- 20
- 42
-
So Laravel 5.3 or 5.4 – Kyslik Jun 17 '17 at 08:58
-
laravel 5.4 it is – Ahmed Nawaz Khan Jun 17 '17 at 09:38
2 Answers
5
I am using ubuntu 16.04 nginx server. The problem was that $_GET
session variables were not being set properly. so what I did was inside /etc/nginx/sites-available/default
and inside location /
block/ directive I changed try_files $uri $uri/ /index.php?$query_string;
to try_files $uri $uri/ /index.php?$args;
and it worked. Or see Laravel 5 - NGINX Server Config Issue with URL Query Strings

Ahmed Nawaz Khan
- 1,451
- 3
- 20
- 42
-
Wow, I have been searching for the cause of this for *far* too long. This solves the issue perfectly. Thank you! – Jul 15 '18 at 03:37
-
This worked for me thank you, but please use code formatting tools next time. – Crasher Mar 03 '20 at 14:46
0
Awsome Thanks #Ahmed
I just had to change mine from
location / {
try_files $uri $uri/ /index.php?$query_string;
}
to
location / {
index index.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
as i saw some of my other sites was using the @rewriteapp part and seem to work fine.

Louwki
- 696
- 1
- 9
- 21
-
-
1@rewriteapp is just like a variable, it references the second location attribute in my example. it injects the 'rewrite ^(.*)$ /index.php/$1 last;' part – Louwki Aug 18 '17 at 08:20