Anvar Logo
01 / 01

How to redirect 404 page simply in Laravel

You can simply redirect 404 page in Laravel by redirecting in the Route.

All you need to do create 404 template page and redirect via Route.

404.blade.php

<!doctype html>

<html lang="{{ app()->getLocale() }}">

<head>

<metacharset="utf-8">

<metahttp-equiv="X-UA-Compatible"content="IE=edge">

<metaname="viewport"content="width=device-width, initial-scale=1">

     <title> 404 - Page not found</title>




</head>

<body>

The page your looking for is not found

</body>

</html>

Route.php

Route::any(‘{slug’},function(){

       Return view(‘404’);

});
by anvar
Published : Jul , 29

Post a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WhatsApp Logo Chat