In this article how to create 404 error page in Laravel, we will show you how to create custom error page in Laravel application. Apart from this, you can create 404, 403, 500, 419, 255, 405, etc. pages in Laravel.
Generally, if we set the debug false, Laravel shows the default error page of their predefined. If you want to create your own custom error page, then you can use this article “create 404 error page in Laravel”.
If you need to create a blade file like 404.blade.php, 405.blade.php, etc. on the errors (resources/view.errors) directory in Laravel. You can see we have created a 404 a blade file so you can check it on your project.
We are using a theme for the front-end or backend side and we are always looking for the set 404, 500, or 505 error page design that we used for the project. So this is a very simple and easy way to create custom 404 pages in the Laravel project.
Now all you have to do is create the “errors” folder in your resource directory and after that, you will need to create 404.blade.the file inside that folder. So, basically the Laravel will complete the default design, but if you have created a 404 file in the “errors” directory, it will take it from there.
So now you just need to create a 404 blade file and insert your code as we have added then you can simply see it.
resources/views/errors/404.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" ></script>
<style type="text/css">
body{
margin-top: 150px;
background-color: #C4CCD9;
}
.error-main{
background-color: #fff;
box-shadow: 0px 10px 10px -10px #5D6572;
}
.error-main h1{
font-weight: bold;
color: #444444;
font-size: 100px;
text-shadow: 2px 4px 5px #6E6E6E;
}
.error-main h6{
color: #42494F;
}
.error-main p{
color: #9897A0;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<div class="row text-center">
<div class="col-lg-6 offset-lg-3 col-sm-6 offset-sm-3 col-12 p-3 error-main">
<div class="row">
<div class="col-lg-8 col-12 col-sm-10 offset-lg-2 offset-sm-1">
<h1 class="m-0">404</h1>
<h6>Page not found - discoverprograming.com</h6>
<p>Lorem ipsum dolor sit <span class="text-info">amet</span>, consectetur <span class="text-info">adipisicing</span> elit, sed do eiusmod.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Read Also: How To Install Laravel In Ubuntu
Now you can just watch it.
I hope it will help you…