diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 548c0430..4d67f1aa 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -338,13 +338,12 @@ class helper { // N'interroge que le serveur Apache if (strpos($_SERVER["SERVER_SOFTWARE"], 'Apache') > 0) { - self::$rewriteStatus === false; - } elseif (self::$rewriteStatus === null) { + self::$rewriteStatus = false; + } else { // Ouvre et scinde le fichier .htaccess $htaccess = explode('# URL rewriting', file_get_contents('.htaccess')); // Retourne un boolean en fonction du contenu de la partie réservée à l'URL rewriting - //self::$rewriteStatus = (empty($htaccess[1]) === false); - self::$rewriteStatus = (strpos($htaccess[1], 'RewriteEngine on') > 0) ? true : false; + self::$rewriteStatus = (strpos($htaccess[1], 'RewriteEngine on') !== false); } return self::$rewriteStatus; } diff --git a/core/module/config/config.php b/core/module/config/config.php index 4cd11ff3..e1c905af 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -902,4 +902,19 @@ class config extends common ]); } } + + /** + * Fonction pour vérifier la présence du module de réécriture + * @return bool + */ + public function isModRewriteEnabled() { + // Check if Apache and mod_rewrite is loaded + if (function_exists('apache_get_modules')) { + $modules = apache_get_modules(); + return in_array('mod_rewrite', $modules); + } else { + // Fallback if not using Apache or unable to detect modules + return getenv('HTTP_MOD_REWRITE') == 'On' || getenv('REDIRECT_STATUS') == '200'; + } + } } \ No newline at end of file diff --git a/core/module/config/view/setup/setup.php b/core/module/config/view/setup/setup.php index b1e34e5c..08ca40e3 100644 --- a/core/module/config/view/setup/setup.php +++ b/core/module/config/view/setup/setup.php @@ -48,7 +48,7 @@ helper::checkRewrite(), 'help' => 'Supprime le point d\'interrogation dans les URL, l\'option est indisponible avec les autres serveurs Web', - 'disabled' => stripos($_SERVER["SERVER_SOFTWARE"], 'Apache') === false + 'disabled' => stripos($_SERVER["SERVER_SOFTWARE"], 'Apache') === false and $module->isModRewriteEnabled() ]); ?>