laravellaravel-5xampplaravel-5.5easyphp

Laravel error: "Sorry, the page you are looking for could not be found"


I need to update a website from a colleague to just add a LDAP connexion.

I use EasyPHP devserver 17.0 with php 7.1.3 and MySQL 5.7.17.

I've read a lot of docs etc to be started and to recover the site in local as it is working actually.

Everything was working so I began to add a login form etc... but when I tried to test a link from the website, it return me the error "Sorry, the page you are looking for could not be found". So I began to search on forums I found some results about routes etc and everything I've tested didn't worked.

So, I decide to use the backup from the website as it was when I juste restore it in local(I precise link to other page and everything was working). I check the link and again, "Sorry, the page you are looking for could not be found". I decide to try another developement tool and download XAMP, exactly same error. I tried with Wamp, Laragon always same error.

In the apache conf mod_rewrite is enabled.

My laravel framework version is: 5.5.39

So my folder look like:

Laravel version 5.5.39

The content of routes > web.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();

My virtualHost in Httpd.conf is:

<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>

I don't know what I could do but please ask me if you need more information to help me.

If it can help; gitLab link from the site I'm trying to restore: https://gitlab.com/balsigergil/btplan

Further precisions: Auth routes is called twice, at first in the HomeControler.php: class HomeController extends Controller

{
    /**
     * 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');
    }
}

And then in the middleware RedirectIfAuthenticated.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);
    }
}

Do you think I need to delete this part from the HomeController :

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

And this part from the middleware:

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

I've delete the auth routes in Routes/web.php


Solution

  • Change your VirutalHost DocumentRoot so the root is the public directory.

    DocumentRoot "C:/Users/sadm-m263733/Desktop/EasyPHP-Devserver-17/eds-www/siteBTPlan/public"