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.

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

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝