自定义错误页面未显示

I'm doing a website using the php framework symfony and twig. I want to display a custom page for errors like 404 or 500. I saw here how to do the custom page, I have the error.html.twig in app/Resources/TwigBundle/views/Exception/error.html.twig but it does not seem to be called, I'm also using the

_errors:
    resource: "@TwigBundle/Resources/config/routing/errors.xml"
    prefix:   /_error

in routing_dev.yaml and neither in the dev nor on the live site you can see the custom or the default error page.

I've looked everywhere to find how does this page gets called but I cannot find anything so if you know how to do it, or where can I find documents about this I would be really grateful.

--I know this question mmay be seen as too broad, but I really can't find anything on google about this, any help will be good--

The error.html.twig will be shown in production on any HTTP error (e.g. 401/ 404/ 500 etc); try it by visiting /made-up-path on your host.

You can't check this catch all error.html.twig directly in dev AFAIK, but you can check for custom 404 error pages. What I have done is rename error.html.twig to error404.html.twig and then test this in the dev environment using /app_dev.php/_error/404.html. as described here. When it works rename back to error.html.twig.

Remember to clear cache after any changes you expect to see in prod environment.

It's a shame you can't test the catch-all error.html.twig.

Seems you little bit misunderstood the doc

  1. You can customize your error page for production env, but when you call your local front controller as app_dev.php you won't see that custom page. So call app.php instead

  2. about routing_dev.yaml

With this route added, you can use URLs like

http://localhost/app_dev.php/_error/{statusCode} http://localhost/app_dev.php/_error/{statusCode}.{format}

to preview the error page for a given status code as HTML or for a given status code and format.

as you can see it will just create additional links to preview the custom pages directly by visiting that links. So if you will call http://localhost/app_dev.php/_error/404.html you will see the preview of that page that will appear on production for "not found"