I want to override the error templates in Symfony 3. I've started by creating a TwigBundle folder withe the personalised twig.
app/
└─ Resources/
└─ TwigBundle/
└─ Exception/
├─ error404.html.twig
├─ error403.html.twig
├─ error.html.twig
Then I checked the routing_dev
file which contains this lines :
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
Symfony still displays the default error templates. I want to know if I should verify something else.
PS : I have already checked this documentation : How to Customize Error Pages
EDIT :
The overriden files should reside in a subfolder named
views
. The correct file tree would look like this:Clear your cache afterwards.
Be aware that those overriden error templates do NOT show up in the
dev
environment.If you want to test the templates in your
dev
environment you must ensure you have imported the following inrouting_dev.yml
:Now you can access
/_error/<error-code>.html
(i.e.localhost:8000/_error/404.html
with the integrated webserver)