diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index 5cd00733f1dc6..e0876ca20e0a2 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -205,6 +205,7 @@ JGLOBAL_LT="<" JGLOBAL_NEWITEMSLAST_DESC="New items default to the last position. Ordering can be changed after this item has been saved." JGLOBAL_NO_MATCHING_RESULTS="No Matching Results" JGLOBAL_NUM="#" +JGLOBAL_OFFLINE_ERROR="This site is offline and the Home Page sends a 404 error. Please contact a site administrator." JGLOBAL_OTPMETHOD_NONE="Disable Two Factor Authentication" JGLOBAL_PASSWORD="Password" JGLOBAL_PASSWORD_RESET_REQUIRED="You are required to reset your password before proceeding." diff --git a/libraries/legacy/error/error.php b/libraries/legacy/error/error.php index ac6feaac0ac6d..fd92097c1dbbf 100644 --- a/libraries/legacy/error/error.php +++ b/libraries/legacy/error/error.php @@ -786,11 +786,21 @@ public static function customErrorPage(&$error) // Push the error object into the document $document->setError($error); + $homemenu = $app->getMenu()->getDefault(JFactory::getLanguage()->getTag()); + $active = $app->getMenu()->getActive(); // If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404) + // If the 404 concerns the home page, exit and display a message if ($error->getCode() == '404' && JFactory::getConfig()->get('offline') == 1) { - JFactory::getApplication()->redirect('index.php'); + if ($homemenu !== $active) + { + JFactory::getApplication()->redirect('index.php'); + } + else + { + jexit(JText::_('JGLOBAL_OFFLINE_ERROR')); + } } @ob_end_clean();