Reputation: 3356
I am working with Symfony 2.5.3 and I am trying to create the custom error page so for example if someone lands on a page or try to access a page that does not exist the 404
error message should appear within the theme of the site.
I understand that default 404
error page sits inside the TwigBundle
that comes with symfony and looking at some other answers on this site people are suggesting that in order to have the custom error page I need to copy them in directory ROOT app/Resources/TwigBundle/views/Exception
so I copied over the error.html.twig
and even created error404.html.twig
but this does not work. I also looked into this solution but still no luck.
I tried to access my development site via http://127.0.0.1:8000/app.php/services
to check may be in production i will see the correct template but I dont, please note that i have cleared the cache before accessing http://127.0.0.1:8000/app.php/services
and I still see the default error template that comes with Symfony
I will really appreciate any help on this.
Upvotes: 0
Views: 565
Reputation: 983
First double check this :
app/Resources/TwigBundle/views/Exception
foldererror.html.twig
OR/AND error404.html.twig
app.php
which is a production environment.Beetween each check
rm -rf app/cache/*
It should works now ;)
Another way to easily test your custom error template in dev mode is to use instead WebfactoryExceptionsBundle who provide a test controller for displaying your custom error page even when kernel.debug is set to true.
Upvotes: 1