Pagination not working on live server (apache)

Published 1 month ago by MartiX

Hi guys,

I've been working on Laravel web app quite a while, now it's time to deploy the site, but a strange problem occurs.

Everythings works fine on development server, but the pagination seems broken on live server. This is the route:

Route::get('/articles/{category}', '[email protected]');

Now the pagination add to URL this "?page=2", which is okay and works fine on the dev server, problem is, that when I click on the page 2 or whatnot, I'm redirected back on the same page with the same list of articles. URL changes but nothing besides redirect to the same list happens.

I think this may be the problem with my .htaccess, well this is not quite my area so I just asume. Does anyone know, what might be the problem?

This is my .htaccess:

<IfModule mod_rewrite.c>    
    <IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
   </IfModule>

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
    RewriteCond ^(.*)$ https://example.com/ [R=301,L]

    ErrorDocument 404 https://example.com

    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?/ [L]
</IfModule>
AhmadGomaa

Make sure : 1- you add links of paginate in blade. 2- use paginate in query 3- the number of paginate(number ) > records in the table .

MartiX

@AhmadGomaa everything is added properly because it's working on dev server as it should, the problem occurs on live server. And the only reason I can think about is .htaccess somehow rewrites (redirects) those URL with ?something.

Please sign in or create an account to participate in this conversation.