Currently, I am working on a project in Laravel 8. for this I want to make some custom error pages specifically a 404 and a 500 page. I want to visit these pages via http://127.0.0.1:8000//404 or http://127.0.0.1:8000//500 so I can showcase them. Now I am able to get the 404 page to show with http://127.0.0.1:8000/404 but not the 500 page. And I am unable to find sources on the internet that go into this regarding Larvel 8.
Is there anyone here that knows how I will be able to manage this? It would be a great help!
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Just create a route for it and return the status code.
Route::get('/500', fn() => abort(500));
Adding custom pages for errors will not simply override the existing error templates. First, you need to publish Laravel’s default error page templates using the
vendor:publish Artisan command. Once the templates have been published, you may customize them to your liking:
php artisan vendor:publish --tag=laravel-errors
You can add temporary routes as @Daan said to view the error pages.