When I try to open page that does exists I get the default error message. How can I make 404 page in these cases?
Asked
Active
Viewed 8,408 times
3 Answers
5
Create a new file resources/views/errors/404.blade.php
Style your page whatever you want, Laravel will match HTTP error code with view filename accordingly.

Pete Houston
- 14,931
- 6
- 47
- 60
2
Lavavel 5.8
If you would like to use Laravel's 404 template, create a file in resources/views/errors/404.blade.php
and add this code.
@extends('errors::minimal')
@section('title', __('Not Found'))
@section('code', '404')
@if($exception->getMessage())
@section('message', $exception->getMessage())
@else
@section('message', __('Not Found'))
@endif
Then in your controller you can use:
abort(404, 'Whatever you were looking for, look somewhere else');

Sagar Sharma
- 33
- 4

stillatmylinux
- 1,399
- 13
- 25
-1
Create a new file resources/views/errors/404.blade.php
then use abort(404) in route or controllers.

Mohammad Gitipasand
- 340
- 3
- 9