处理404错误Joomla 2.5 [英] Handling 404 error Joomla 2.5

查看:74
本文介绍了处理404错误Joomla 2.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试根据这些文档将我的所有404错误重定向到我的网站上:

I try to redirect all my 404 error on my web site following those docs :

http://docs.joomla.org/Creating_a_Custom_404_Error_Page

所以我编辑了error.php:

So I edited my 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错误页面的链接-现在应该将其重定向到我的主页时,它将转到以下链接:

But when I clic on a link that should redirect me to a 404 error page - which should now redirect to my home page, it goes to the following link instead :

http://www.mywebsite.com/index.php?Itemid=359

我该如何解决这个问题?

How may I solve that problem ?

推荐答案

Joomla在构建页面时需要itemID.我的猜测是您的默认页面是项目ID359.Joomla最有可能将其附加到URL,因为您没有启用了重写功能的SEF URL.

Joomla needs an itemID when building a page. My guess is that your default page is item ID 359. Joomla is appending that to the URL most likely because you do not have SEF URLs with rewrite turned on.

这篇关于处理404错误Joomla 2.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆