【发布时间】:2015-11-17 01:01:39
【问题描述】:
长期以来,我一直在尝试为我的 joomla 2.5 网站启用自定义 404 页面,因为默认的红色错误页面不是一个选项。
我启用了它,但是,它仅在用户输入 site.com/wrong_page 并且如果用户输入以下结构 site.com/wrong_page/wrong_page 的 url 时它不显示任何内容,只是空白页。
因此,如果用户转到“商品”页面,然后转到不存在的项目 site.com/goods/wrong_itemid,它不会显示自定义错误,它什么也不显示,但如果用户打开 site.com/wrong_link 他会查看自定义错误页面。
请帮我解决这个问题。
我在error.php中使用了以下内容:
switch ($this->error->code) {
case '404':
header('location: /404-page');
break;
case '500':
include('500.php');
break;
case '403':
include('403.php');
break;
default:
header('location: /404-page');
}
【问题讨论】:
-
向我们展示你们中的一些编码 sn-ps
-
我添加了一些我使用的代码
标签: php joomla custom-error-pages