【问题标题】:Random Sorry, the page you are looking for could not be found Laravel 5.5随机 抱歉,找不到您要找的页面 Laravel 5.5
【发布时间】:2018-07-31 02:04:03
【问题描述】:

我有这个程序运行良好,没有任何错误 并且在随机时间,我得到了这个错误页面。

抱歉,找不到您要查找的页面。

在我尝试访问的任何页面中。此错误会持续几分钟,稍后会自行清除,因为相同的页面会按预期显示。

很少的路由代码

Route::get('/', 'indexController@index')->name('index-post-page'); Route::get('/login', 'indexController@login')->name('index-login-page'); Route::get('/post/{post_id}/{title}','indexController@SinglePost')->name('SinglePost-page'); Route::get('/account/contributor/dashboard','indexController@ContributorsDashboard')->name('page-contributor-admin'); Route::prefix('account')->group(function() { Route::get('/', 'indexController@accountDashboard')->name('admin-home-page'); Route::get('/nonadmin', 'indexController@accountDashboardNonAdmin')->name('page-non-admin'); Route::get('/nonadmin', 'indexController@ContributorsDashboard')->name('page-non-admin'); Route::get('/admin/add/category', 'indexController@AddCategory')->name('page.add.category'); Route::get('/admin/view/category', 'indexController@viewCategory')->name('page.load.all.category'); Route::get('/admin/audit/featured', 'indexController@AuditFeatured')->name('page.feature.unfeature.post'); Route::get('/post/notification/data/{contributor_id}', 'indexController@PostNotificationReportData')->name('admin.post.notification.report.data'); })

检查了错误日志,我看到的只是 ERROR 404(找不到页面)- 尽管该页面存在

我想相信这不是程序问题,而是服务器问题,因为我在另一台服务器上托管了相同的脚本并且一切顺利。

但我不知道该告诉服务器管理员什么导致错误或我需要他修复什么。

网址:program link

登录链接:AUTOMATIC_LOGIN

谁能给我一个提示或究竟是什么导致了这个随机错误 404

【问题讨论】:

  • 我有这个程序可以完美运行,我随机得到这个错误页面。我不会说它运行完美 ;-)
  • 读取.htacess文件似乎有问题,它一直重定向到/public/login,通常它只会到/login
  • 调整您的 .htaccess 并仔细检查文件的所有权和权限。
  • 我实际上使页面重定向到登录页面,直到他们从同一域名上的另一个应用程序登录 @Sérgio Reis
  • 好吧,除非您向我们展示任何代码,否则我们只能猜测......

标签: php laravel error-handling http-status-code-404


【解决方案1】:

确保在您的 apache 配置中,您的 Web 根目录指向公共目录而不是应用程序根目录。

<VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
  ServerAdmin webmaster@host.example.com
    DocumentRoot "/www/docs/host.example.com/public"
    ServerName host.example.com
    ErrorLog "logs/host.example.com-error_log"
    TransferLog "logs/host.example.com-access_log"
</VirtualHost>

【讨论】:

  • 我对指向 /public 的应用程序没有任何问题,问题是 ERROR 404 它一直在随机时间显示该错误并在随机时间消失 登录页面: stag.armacademy.com.ng/login.php
  • this 或 .htaccess 很可能是您的问题。与它工作的主机有什么不同?
  • @VictoriaFriday /public 不应出现在 URL 中。您可能会暴露应用程序中不应该被提供的部分。为了澄清,请确保您的 VirtualHost 指令中的文档根目录在路径中包含 /public。 &lt;VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80&gt; ServerAdmin webmaster@host.example.com DocumentRoot "/www/docs/host.example.com/public" ServerName host.example.com ErrorLog "logs/host.example.com-error_log" TransferLog "logs/host.example.com-access_log" &lt;/VirtualHost&gt;
  • @happymacarts 没有区别。另一台服务器上的代码相同。
  • @Jason 非常感谢您提供的安全提示。使 VirtualHost 直接指向公用文件夹没有任何问题。我的问题是为什么突然,服务器上的每个页面都返回 ERROR 404。几分钟后,一切正常。这就是我现在的注意力问题。
【解决方案2】:

问题仅仅是因为您的 laravel 应用程序在没有 /public 的情况下会运行得更好,尤其是当您从生命服务器运行时。

我知道这听起来很难相信,但是让您的网络服务器指向 public_html/public/ 并且您的应用程序将完美运行而不会再出现 ERROR 404。

这符合@jason 的建议。

【讨论】:

  • 非常感谢这解决了我的问题。让网络服务器指向 public_html/public 为我解决了整个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-11-15
  • 2017-05-15
  • 1970-01-01
  • 1970-01-01
  • 2018-04-22
  • 2019-04-17
  • 1970-01-01
相关资源
最近更新 更多