0

My website has been upgraded from a custom written 1.5 template and I need to run a link checked over it to discover broken links.

For one url:

/index.php?option=com_content&task=view&id=2639&lang=en

The page returns a HTTP 200 OK header, however the page contains: "Error Category not found"

In /libraries/legacy/view/category.php:131 there is clearly code to return a 404 error:

return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));

Am I doing something wrong in my template?

0

Do you have an error.php in your template generating a header 404 when a page is not found?

My error.php contains the following information:

<?php
/*
 * @package     perfecttemplate
 * @copyright   Copyright (c) Perfect Web Team / perfectwebteam.nl
 * @license     GNU General Public License version 3 or later
 */

// No direct access.
defined('_JEXEC') or die;

if (($this->error->getCode()) == '404')
{
    header("HTTP/1.0 404 Not Found");
    switch (JFactory::getLanguage()->getTag())
    {
        #case 'en-GB':
        #   echo file_get_contents(JURI::base().'en/404');
        #   break;

        default:
            // get Joomla! article with menu item alias = 404
            echo file_get_contents(JURI::base().'404');
    }
    exit;
}

if (($this->error->getCode()) == '403')
{
    header("HTTP/1.0 403 Forbidden");
    switch (JFactory::getLanguage()->getTag())
    {
        #case 'en-GB':
        #   echo file_get_contents(JURI::base().'en/404');
        #   break;

        default:
            // get Joomla! article with menu item alias = 403
            echo file_get_contents(JURI::base().'403');
    }
    exit;
}

If a certain error occurs the header will respond with it's corresponding reply. In my case only 403 or 404.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.