Firstly Create a 404 and 500 error page in resources/views/errors/404.blade.php

Go to-> app/Exceptions/Handler.php


public function render($request, Exception $e)
{

// custom error message
if ($e instanceof \ErrorException) {
return response()->view(‘errors.500’, [], 500);
} else {
return parent::render($request, $e);
}

}