Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Wakanda's avatar
Level 10

How to customise Laravel Nova 3 error pages?

How to customize Laravel Nova 3 error pages?

404, 500, 403

I got this https://medium.com/laravel-nova/laravel-nova-custom-error-pages-bd382e7007d7 after searching and this worked with older versions of Nova.

Has anyone ever done this (Nova v3)? If yes please provide guidance to get started.

0 likes
2 replies
tisuchi's avatar

@wakanda

  1. Create a new folder named errors inside the resources/views folder of your Nova application.

  2. Inside the errors folder, create three new Blade templates for each error page: 404.blade.php, 500.blade.php, and 403.blade.php.

  3. In each of the newly created templates, you can customize the HTML and layout of the error pages. You can also include any custom CSS or JavaScript to make the pages match your Nova app's design.

  4. Next, you will need to tell Nova to use your custom error pages instead of the default ones. To do this, you can create a new service provider by running the command php artisan make:provider CustomErrorPagesServiceProvider.

  5. In the register method of your new service provider, you can use the Illuminate\Foundation\Exceptions\Handler facade to set your custom error views. You can do this by adding the following code:

    public function register()
    {
        \Illuminate\Foundation\Exceptions\Handler::register(function (\Exception $exception) {
            if ($exception instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
                return response()->view('errors.404', [], 404);
            } else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
                return response()->view('errors.500', [], 500);
            } else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\ForbiddenHttpException) {
                return response()->view('errors.403', [], 403);
            }
        });
    }
  1. Finally, add your new service provider to the providers array in your config/app.php file.

  2. Now, you should see your custom error pages when the app encounters a 404, 500 or 403 error.

Wakanda's avatar
Level 10

@tisuchi I tried this there is an error Non static method 'register' should not be called

and

Error Non-static method Illuminate\Foundation\Exceptions\Handler::register() cannot be called statically

1 like

Please or to participate in this conversation.