【问题标题】:Error "Sorry, the page you are looking for could not be found." Laravel 5.5错误“抱歉,找不到您要查找的页面。”拉拉维尔 5.5
【发布时间】:2019-04-17 07:56:38
【问题描述】:

试图恢复 laravel 应用程序。无法访问任何路由,到处报错“抱歉,找不到您要查找的页面。”

我的网页.php

Route::get('/', 'IndexController@getIndex');

Route::get('/posts', 'IndexController@getPosts');

Route::get('/posts/{id}', 'IndexController@getPost');

Route::get('/posts/category/{id}', 'IndexController@getPostCategory');

Route::get('/reviews', 'IndexController@getReviews');

Route::get('/pages/{id}', 'IndexController@getPage');

Route::get('/contacts', 'IndexController@getContacts');

Route::post('/request', 'IndexController@postRequest');

Auth::routes();

Route::get('/admin', 'HomeController@index');

Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function()
{
    Route::resource('settings', 'SettingController');

    Route::resource('products', 'ProductController');

    Route::resource('data', 'DataController');

    Route::resource('reviews', 'ReviewController');

    Route::resource('posts', 'PostController');

    Route::resource('pages', 'PageController');
});

所有控制器和视图都存在。 Apache DocumentRoot 是 /public/ 目录。标准 laravel .htaccess。

【问题讨论】:

    标签: php laravel apache


    【解决方案1】:

    我希望我能获得更多信息,但我会尽力而为。

    Laravel 需要来自 apache 的 2 个东西才能开始工作

    1. 启用重写sudo a2enmod rewrite
    2. .htaccess 已启用

    你可以通过编辑/etc/apache2/apache2.conf来做到这一点 并将AllowOverride None 更改为AllowOverride All。 这应该为/var/www(apache 的默认 DocumentRoot)完成

    完成此操作后,使用php artisan serve 启动 PHP 服务器。

    【讨论】:

    • 你好。谢谢您的回答,请问您需要什么资料?关于重写和.htaccess,一切都启用了
    • 我不这么认为,所以只需检查一下这个 404 是否属于 laravel,所以它会响应您可以在 / 路由中的 dd() 确保并在其他一些路由中执行相同操作
    • stackoverflow.com/questions/22757749/… 看到这个了解更多
    • 了解问题所在。在我的控制器“IndexController”中,我有一个方法“getIndex”,有设置、数据和其他并返回视图,但在此代码之后 $settings = Setting::findOrFail(1);我什至没有看到 dd()。确实存在某种问题。
    • 事实证明,问题完全不同。设置表中没有数据,所以 findOfFail 异常。但我认为如果问题出在网络服务器上,您会帮我解答)
    猜你喜欢
    • 1970-01-01
    • 2017-01-07
    • 1970-01-01
    • 2018-07-31
    • 2018-04-22
    • 1970-01-01
    • 2017-05-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多