GeekShop how to create a custom 404 page?

stantyan

Mar 31st, 2017 01:15 PM

Hi Admin,

I have been on all these laracasts and stackoverflow forums and tried almost every their solution, but none of them worked for Geekshop.

I know I have to modify something in app/Exceptions/Handler.php and I already created a /resources/views/themes/white/errors/404.blade.php page.

I cannot go live without making a custom 404 page, these laravel exception errors repors reveal too much sensitive information about server. Or can you suggest how to redirect all 404 errors to homepage with permanent redirect, if this is more easier and quicker to implement.

Thank you in advance!

stantyan

Mar 31st, 2017 04:22 PM

Some suggest that just creating a /resources/views/themes/white/errors/404.blade.php is enough to display custom 404 page. But it did not work in GeekShop case.

https://mattstauffer.co/blog/laravel-5.0-custom-error-pages

mark

Mar 31st, 2017 05:10 PM

I believe the file should be /resources/views/errors/404.blade.php.

stantyan

Apr 2nd, 2017 06:47 PM

Hi Mark, thank you for your reply! I tried creating 404 blade in this directory too. still no luck :( Something ned to be modified inside app/Exceptions/Handler.php but I have no idea what.

mark

Apr 3rd, 2017 04:13 AM

In the render method, try this:

if ($exception instanceof YourException) {
    return response()->view('errors.404', [], 404);
}

Please replace the YourException with the actual exception class that you get.