douliu8327 2015-08-27 13:46
浏览 72
已采纳

未找到Laravel 5.1分页URL错误404

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.

  • 写回答

1条回答 默认 最新

  • dongyu8694 2015-08-27 13:53
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?