我尝试重定向我所有的404错误在我的网站下面的那些文档:处理404错误的Joomla 2.5
所以我编辑我的error.php:
<?php
defined('_JEXEC') or die;
if (($this->error->getCode()) == '404') {
header('Location: http://www.mywebsite.com');
exit;
}
if { (!isset($this->error)) {
$this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$this->debug = false;
}
//get language and direction
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;
?>
但是,当我点击一个链接,应该重定向到一个404错误页面 - 现在应该重定向到我的主页,它转到下面的链接,而不是:
我怎么可能解决这一问题?
重定向404到您的主页是一个坏主意。如果页面没有了,你需要提供404,否则Google会给你提供问题。您应该使用搜索功能和/或其他相关链接自定义404错误页面。请参阅下面的原始问题。 –