I am trying to implement 404 page, but so far nothing is happening. I am getting this:
Not Found
The requested URL /test was not found on this server.
I have custom 404 page with completely different text.
In my routes file I have this route:
Route::fallback(function(){
return response()->view('errors/404', [], 404);
});
In Handler.php I added this:
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
if ($exception instanceof MethodNotAllowedHttpException)
abort(404);
if ($this->isHttpException($exception)) {
if ($exception->getStatusCode() == 404) {
return response()->view('errors.404', [], 404);
}
}
return parent::render($request, $exception);
}
The 404.blade.php is located under the resources/view/errors