错误404页面未在Symfony 5上的生产模式显示
我正在尝试自定义404页,但它仅在开发模式下出现。当我切换到生产模式时,Symfony Exception Page将显示“ get http://127.0 。 0.1:8000/xxxxxxxx”。
我的缓存被清空了,我执行了多个命令,包括“作曲家dump-env prod”,添加了一个.env.local.php文件,我还修改了控制器,但无关。检查了几个文件,包括NotFoundHttpexception.php,httpexception.php,debug_prod.php,“ bin”文件夹中的“控制台”文件,doutes.yaml,routerlistener.php和其他文件。
这是我正在寻找的结果: 默认页面,
但这是我拥有的: 例外页
我真的需要您的帮助,请提前。
这是我的路由。yaml文件
index:path: / controller:app \ controller \ defaultController :: index < / code>
I am trying to customize a 404 page but it only appears in dev mode. When I switch to production mode, the Symfony exception page is displayed with the message No route found for “GET http://127.0 .0.1:8000/xxxxxxxx”.
My cache was emptied, I performed several commands including “composer dump-env prod” which added a .env.local.php file I also modified my Controller but nothing to do. Several files were checked including NotFoundHttpException.php, HttpException.php, debug_prod.php, “console” file in “Bin” folder, routes.yaml, RouterListener.php and other files.
here is the result I am looking for:
default page
but here is what I have:
exception page
I really need your help please, thanks in advance.
here is my routes.yaml file
index: path: / controller:App\Controller\DefaultController::index
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的404模板本身有一个错误。删除其所有内容,并使用一些简单的文本开始。如果有效,请开始添加旧内容,直到再次破裂为止。您会知道有什么问题。
Your 404 template has itself an error. Remove all its content and start fresh with some simple text. If it works, begin adding old content until it breaks again. You'll know what is the issue.