Error pages for the production environment can be customized in different ways depending on your needs:

  1. If you just want to change the contents and styles of the error pages to match the rest of your application, override the default error templates;
  2. If you want to change the contents of non-HTML error output, create a new normalizer;
  3. If you also want to tweak the logic used by Symfony to generate error pages, override the default error controller;
  4. If you need total control of exception handling to execute your own logic use the kernel.exception event.

Overriding the Default Error Templates

You can use the built-in Twig error renderer to override the default error templates. Both the TwigBundle and TwigBridge need to be installed for this. Run this command to ensure both are

Scroll to Top