代码之家  ›  专栏  ›  技术社区  ›  Fabien Pittier

Laravel错误:“抱歉,找不到您要查找的页面”

  •  0
  • Fabien Pittier  · 技术社区  · 7 年前

    我需要更新一个同事的网站,只需添加LDAP连接。

    我在php 7.1.3和MySQL 5.7.17中使用EasyHP devserver 17.0。

    我已经阅读了很多文档等,以开始和恢复在当地的网站,因为它是实际工作。

    一切正常,所以我开始添加登录表单等。。。但当我尝试测试网站的链接时,它返回错误“抱歉,找不到您正在查找的页面”。所以我开始在论坛上搜索,我找到了一些关于路线等的结果,但我测试的所有东西都不起作用。

    因此,我决定使用网站的备份,就像我在本地还原它时一样(我精确链接到其他页面,一切正常)。我检查了链接,然后再次说:“对不起,找不到您要查找的页面”。我决定尝试另一个开发工具并下载XAMP,完全相同的错误。我试着用Wamp,Laragon总是犯同样的错误。

    在apache conf中,启用mod\u rewrite。

    我的laravel框架版本是:5.5.39

    所以我的文件夹看起来像:

    Laravel version 5.5.39

    路线的内容>网状物php:

    Route::get('/', function () {
        return view('welcome');
    })->name('welcome');
    
    // Holidays
    Route::get('/holidays/create', 'HolidayController@create')->name('holidays.create');
    Route::post('/holidays', 'HolidayController@store')->name('holidays.store');
    Route::get('/holidays/{holiday}/delete', 'HolidayController@destroy')->name('holidays.destroy');
    Route::get('/holidays/{holiday}/edit', 'HolidayController@edit')->name('holidays.edit');
    Route::post('/holidays/{holiday}', 'HolidayController@update')->name('holidays.update');
    
    // Leave types
    Route::get('/types/create', 'TypeController@create')->name('types.create');
    Route::post('/types', 'TypeController@store')->name('types.store');
    Route::get('/types/{type}/delete', 'TypeController@destroy')->name('types.destroy');
    Route::get('/types/{type}/edit', 'TypeController@edit')->name('types.edit');
    Route::post('/types/{type}', 'TypeController@update')->name('types.update');
    
    // Users
    Route::resource('users', 'UserController');
    Route::get('/births', 'UserController@getAllBirths')->name('births');
    
    // Leaves
    Route::get('/calendar', 'LeaveController@index')->name('calendar');
    Route::post('/leaves', 'LeaveController@store')->name('leaves.store');
    Route::post('/leaves/{leave}', 'LeaveController@update')->name('leaves.update');
    Route::get('/leaves/{leave}/delete', 'LeaveController@delete')->name('leaves.delete');
    Route::get('/leaves', 'LeaveController@getAll')->name('leaves');
    
    Route::get('/config', 'ConfigController@index')->name('config');
    
    // Stats
    Route::get('/statistics', 'StatsController@index')->name('stats.index');
    
    Auth::routes();
    

    我的Httpd虚拟主机。形态为:

    <VirtualHost 127.0.0.1>
        DocumentRoot "C:/Users/sadm-m263733/Desktop/EasyPHP-Devserver-17/eds-www"
        ServerName 127.0.0.1
        <Directory "C:/Users/sadm-m263733/Desktop/EasyPHP-Devserver-17/eds-www">
            Options FollowSymLinks Indexes ExecCGI
            AllowOverride All
            Order deny,allow
            Allow from 127.0.0.1
            Deny from all
            Require all granted
        </Directory>
    </VirtualHost>
    

    我不知道我能做什么,但是如果你需要更多的信息来帮助我,请问我。

    如果有帮助;我尝试还原的站点的gitLab链接: https://gitlab.com/balsigergil/btplan

    进一步精度: Auth routes被调用两次,首先在HomeControler中调用。php: 类HomeController扩展控制器

    {
        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            $this->middleware('auth');
        }
    
        /**
         * Show the application dashboard.
         *
         * @return \Illuminate\Http\Response
         */
        public function index()
        {
            return view('home');
        }
    }
    

    然后在中间件中重定向身份验证。php:

    use Illuminate\Support\Facades\Auth;
    
    class RedirectIfAuthenticated
    {
        /**
         * Handle an incoming request.
         *
         * @param  \Illuminate\Http\Request  $request
         * @param  \Closure  $next
         * @param  string|null  $guard
         * @return mixed
         */
        public function handle($request, Closure $next, $guard = null)
        {
            if (Auth::guard($guard)->check()) {
                return redirect('/home');
            }
    
            return $next($request);
        }
    }
    

    您认为我需要从HomeController中删除此部分吗:

    public function __construct()
    {
        $this->middleware('auth');
    }
    

    这部分来自中间件:

    if (Auth::guard($guard)->check()) {
                return redirect('/home');
            }
    

    我已在routes/web中删除身份验证路由。php

    3 回复  |  直到 7 年前
        1
  •  1
  •   SystemGlitch    7 年前

    更改VirutalHost文档根,以便根是 public 目录

    DocumentRoot "C:/Users/sadm-m263733/Desktop/EasyPHP-Devserver-17/eds-www/siteBTPlan/public"
    
        2
  •  0
  •   SystemGlitch    7 年前

    由于未对应用程序使用身份验证,请删除 auth 来自控制器的中间件,这将很好。

    $this->middleware('auth'); //Remove this line
    
        3
  •  0
  •   Peter Estiven    7 年前

    Laravel的根不是Laravel文件夹的根。您需要将文档根目录设置为Laravel public 文件夹

    DocumentRoot "<your-laravel-path>/public"