I want to work on the 404 page from the dev environment. I customize 404 using this file : app/Resources/TwigBundle/views/Exception/error.html.twig
This prod url work correctly : mysite.com/404
But this one mysite.com/app_dev.php/404
throw a NotFoundHttpException and give me the dev debug page.
Is it possible to display the error page instead of debug page ?
UPDATE:
The official documentation has now a chapter about that : Testing Error Pages during Development
Google Search Console: You will find a list of all 404 pages by logging into your Google search console account and going to Diagnostics > Crawl Errors. After you click on “Not Found”, a list of all the urls that result in a 404 error will appear.
404s should not always be redirected. 404s should not be redirected globally to the home page. 404s should only be redirected to a category or parent page if that's the most relevant user experience available. It's okay to serve a 404 when the page doesn't exist anymore (crazy, I know).
404 errors occur when a user or search crawler tries to access a page that does not appear to exist on a domain. 404 errors happen when: A page is deleted from your website without a 301 redirect. Someone makes a mistake typing the page URL into their browser's address bar.
To display error pages, in web/app_dev.php change second parameter to false
$kernel = new AppKernel('dev', false);
After testing what you need, change it back.
UPDATE
Thanks @user2019515 for pointing that out - now (2.3 and up) there's a link to WebfactoryExeptionsBundle in Symfony docs and the method I wrote above should not be used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With