Error pages for the production environment can be customized in different ways depending on your needs:
- 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;
- If you want to change the contents of non-HTML error output, create a new normalizer;
- If you also want to tweak the logic used by Symfony to generate error pages, override the default error controller;
- 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