diff --git a/public_html/classes/redirect.class.php b/public_html/classes/redirect.class.php index 7d9231d5ce910c331abd37bee4109d8d432ef320..c04108a2279046efa59d944753aa28b4d45c725b 100644 --- a/public_html/classes/redirect.class.php +++ b/public_html/classes/redirect.class.php @@ -23,6 +23,7 @@ * 2019-04-25 v1.2 ah use REQUEST_URI (works on Win and Linux) * 2020-05-06 v1.3 ah added aliases for multiple domains with the same config * 2020-05-06 v1.4 ah rewrite as class + * 2023-08-28 v1.5 ah fix loop over config with missing regex section. */ /** @@ -229,13 +230,14 @@ class redirect { $aRedirect = $this->aConfig['direct'][$this->sRequest]; } else { $this->_wd("no direct match ... scanning regex"); - foreach (array_keys($this->aConfig['regex']) as $sRegex) { - - $this->_wd("check if regex [$sRegex] matches $this->sRequest"); - if (preg_match('#' . $sRegex . '#', $this->sRequest)) { - $this->_wd("REGEX MATCH! aborting tests"); - $aRedirect = $this->aConfig['regex'][$sRegex]; - break; + if(isset($this->aConfig['regex']) && is_array($this->aConfig['regex'])){ + foreach (array_keys($this->aConfig['regex']) as $sRegex) { + $this->_wd("check if regex [$sRegex] matches $this->sRequest"); + if (preg_match('#' . $sRegex . '#', $this->sRequest)) { + $this->_wd("REGEX MATCH! aborting tests"); + $aRedirect = $this->aConfig['regex'][$sRegex]; + break; + } } } }