php - 将 Laravel 应用程序部署到共享主机后,分页链接错误
问题描述
我使用 ajax 在其框架中加载分页内容。本地主机一切正常。例如,在http://localhost:8000/exampleroute
评论部分的分页链接中,第 2 页是:http://localhost:8000/content/page_comments?page=2
并且效果很好。
但是在共享主机中是:https://example.com/content/page_comments?%2Fexampleroute=&page=2
并且链接不起作用。我猜这个问题与 .htaccess 文件有关。所以 .htaccess 内容在这里:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
什么是基础问题?
解决方案
RewriteBase /
似乎这可能是问题所在。
删除它并与https://laravel.com/docs/5.6/installation#pretty-urls进行比较。确保在您的.env
文件中APP_URL
为您的应用程序 url 设置了值。
推荐阅读
- python - 在特定时期后开始回调 val acc
- opencv - 如何跟踪图像上的 2d 点以进行 3d 重建,如 opencv sfm 管道中指定的那样?
- c# - 如何模拟 HttpContext 以访问 IIdentity 的扩展方法?
- vb.net - 有没有办法可以在不添加 5 种不同形式的情况下设计 5 次表单
- java - 为队列设置密钥
- python - 如何使用 python 代码在终端/cmd 中创建可点击的单词/单元格
- html - 如何在 Outlook 2007 电子邮件中嵌入图像或视频
- sql - 日期部分时的 SQL 案例
- java - 计算数组中特定点的自由元素
- python - 获取 Pandas 数据框中具有最大值的行