【问题标题】:Symfony: sfError404Exception: This request has been forwarded to a 404 error page by the actionSymfony:sfError404Exception:此请求已被操作转发到 404 错误页面
【发布时间】:2010-07-07 11:32:39
【问题描述】:
在 Symfony 1.3 中构建网站时,我的开发服务器拒绝显示我的自定义 404 页面。
我已将配置设置保留为标准设置,因此我的错误模块是默认模块,这可以在我的调试工具栏中看到:
sf_error_404_action: error404
sf_error_404_module: default
此请求已通过“文章/编辑”操作转发到 404 错误页面。
为什么我的自定义 404 页面没有显示?
【问题讨论】:
标签:
php
debugging
redirect
symfony1
http-status-code-404
【解决方案1】:
事实证明,这实际上是打开调试时的默认行为。
如果您想查看实际的“404”错误页面,请关闭调试。
index.php:Symfony 显示 symfony 错误页面
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
sfContext::createInstance($configuration)->dispatch();
index.php:Symfony 显示自定义 404 错误页面
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', false);
sfContext::createInstance($configuration)->dispatch();