简体   繁体   English

找不到Laravel 5.1分页URL错误404

[英]Laravel 5.1 Pagination URL Error 404 Not Found

I am using Laravel 5.1 on WAMP Server 2.5. 我在WAMP Server 2.5上使用Laravel 5.1。

And I have this error while working on pagination. 我在分页时遇到此错误。

404 Not Found 找不到404

While I run my site locally using this php artisan serve 当我使用此php artisan服务在本地运行我的网站时

php artisan serve --port=212 php artisan serve --port = 212

I run to my site index url http://localhost:212/displays . 我运行到站点索引URL http:// localhost:212 / displays The pagination works fine, its pagination link work fine on every page http://localhost:212/displays?page=2 . 分页工作正常,其分页链接在每个页面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. 但是,当我在没有php artisan servehttp:// localhost / bookstore / public / displays )的情况下手动运行它时,分页链接出错。 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. 分页链接最初是打印输出http:// localhost / bookstore / public / displays /?page = 2 ,但是当页面完全呈现时,它会自动更改为http:// localhost / displays?page = 2

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). 这可能是因为你注定要在服务器上设置Web根到public文件夹(Laravel假设是这种情况)。

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. 正因为如此,Web根被设置为地方两级以上的public文件夹,所以当Laravel试图重定向到/displays?page=2它试图向您发送了错误的文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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