【发布时间】:2009-08-15 01:17:54
【问题描述】:
您好为 joomla 创建了一个 error.php 以将 404 错误等重定向到 joomla 文章。下面的代码适用于 404 错误,但 403 会返回空白页。我可以直接在我的脚本之外导航到该页面,因此它必须是我的代码或者它在其环境中的交互方式。
谢谢 斯蒂芬
defined( '_JEXEC' ) or die( 'Restricted access' );
if ($this->error->code == 404)
{
Header( "HTTP/1.1 404 Not found" );
header("Location: http://www.queensberry.com/misc/filenotfound/");
} else if ($this->error->code == 403) {
Header( "HTTP/1.1 403 Restricted Content" );
Header( "Location: http://www.queensberry.com/restrictedcontent/" );
} else {
echo "hello world error code = " . $this->error->code;
}
?>
【问题讨论】:
-
您是否尝试过使用小写 header() 进行 403 重定向?
-
函数在 PHP 中不区分大小写
标签: php joomla webserver http-status-code-404 http-status-code-403