A
A
Alexey Ruzanov2018-02-21 15:46:57
Joomla
Alexey Ruzanov, 2018-02-21 15:46:57

How to remove 302 redirect from 404 error?

Hello! Right now the HTTP status code is 302, need 404.
Here is the full content of the error.php used:
/**
* @package Joomla.Site
* @subpackage Template.system
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!isset($this->error))
{
$this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$this->debug = false;
}
// Get language and direction
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$this->language = $doc->language;
$this->direction = $doc->direction;
?>
<?php
if ($this->_error->get('code') == '404') {
header("HTTP/1.0 404 Not Found");
header('Location: index.php?option=com_content&view=article&id=710');
exit;} ?>
On other sites I use this code and a 404 response.
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<?php
if ($this->error->getCode() == '404') {
echo file_get_contents(JURI::root().'/error-404');
}
?>
Tell me what is wrong and how to fix it? Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question