简体   繁体   中英

Laravel 5.1 Pagination URL Error 404 Not Found

I am using Laravel 5.1 on WAMP Server 2.5.

And I have this error while working on pagination.

404 Not Found

While I run my site locally using this php artisan serve

php artisan serve --port=212

I run to my site index url http://localhost:212/displays . The pagination works fine, its pagination link work fine on every page http://localhost:212/displays?page=2 .

But when I run it manualy without php artisan serve ( http://localhost/bookstore/public/displays ), the pagination link goes wrong. The pagination link originally printout http://localhost/bookstore/public/displays/?page=2 , but it automatically change into http://localhost/displays?page=2 when the page fully rendered.

Is anyone have same problem like me? Glad if any of you could help.

This is likely because you're meant to set the web root on your server to the public folder (and Laravel assumes that that's the case).

As it is, your web root is set to somewhere two levels above the public folder, so when Laravel tries to redirect to /displays?page=2 it tries to send you to the wrong folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM