0

This is my first post on Stackoverflow but I have been watching you for a long time. Thanks. My question is simple. It is possible to redirect to my old site after a fatal error on Joomla 4.2.5. Here is the file at system/fatal.php. On the next lines of code, I wonder if by adding a condition somewhere:

/**
 * @package     Joomla.Site
 * @subpackage  Template.system
 *
 * @copyright   (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;

/**
 * Note: This file is only used when unrecoverable errors happen,
 * normally at boot up stages, and therefore it cannot be assumed
 * that any part of Joomla is available (Eg: a Factory or application)
 *
 * For "normal" error handling, use error.php not this file.
 *
 * @var  HtmlErrorRenderer  $this       object containing charset
 * @var  string             $statusText exception error message
 * @var  string             $statusCode exception error code
 */

// Fallback template
$template = '{{statusCode_statusText}}';

// Joomla supplied fatal error page
if (file_exists(__DIR__ . '/fatal-error.html')) {
    $template = file_get_contents(__DIR__ . '/fatal-error.html');

**BY ADDIND A CONDITION HERE BUT I'M NOT SO SURE IF THIS WILL CONFLICTING WITH SOMETHING ELSE**

}

/**
 * User supplied fatal error page.

 *
 * Allow overriding Joomla supplied page to prevent changes being wiped on Joomla upgrade.
 * We allow it to be a PHP file so that any post-processing, alerting etc can happen.
 */
if (file_exists(__DIR__ . '/fatal-error.custom.php')) {
    require __DIR__ . '/fatal-error.custom.php';

    return;
}


I could redirect people to my old site?

Thank's reading me!


echo str_replace(
    ['{{statusCode_statusText}}', '{{statusCode}}', '{{statusText}}'],
    [$statusCode . ' - ' . $statusText, $statusCode, $statusText],
    $template
);

1 Answers1

0

I just did an html meta tag redirect to the fatal-error.html file and everything is ok. I'm just embarrassed for this stupid question.