diff --git a/e107_handlers/redirection_class.php b/e107_handlers/redirection_class.php index 065b6c17ad..99548755f2 100644 --- a/e107_handlers/redirection_class.php +++ b/e107_handlers/redirection_class.php @@ -465,9 +465,12 @@ public function redirectStaticDomain() return false; } - if(strpos($this->subdomain, 'static') !== false) + $tmp = explode('.',$this->domain); + + if(!empty($tmp[0]) && strpos($tmp[0], 'static') !== false) { - return str_replace($this->subdomain.'.'.$this->domain.'/', $this->domain.'/', $this->self); + unset($tmp[0]); + return str_replace($this->domain.'/', implode('.',$tmp).'/', $this->self); } return false; diff --git a/e107_tests/tests/unit/redirectionTest.php b/e107_tests/tests/unit/redirectionTest.php index 742d4c6fc4..ff4deaeaf0 100644 --- a/e107_tests/tests/unit/redirectionTest.php +++ b/e107_tests/tests/unit/redirectionTest.php @@ -87,8 +87,7 @@ public function testRedirectStaticDomain() $result = $this->rd->redirectStaticDomain(); $this->assertEmpty($result); - $this->rd->domain = 'e107.org'; - $this->rd->subdomain = 'static1'; + $this->rd->domain = 'static1.e107.org'; $this->rd->staticDomains = ['https://static1.e107.org', 'https://static2.e107.org']; $this->rd->self = 'https://static1.e107.org/blogs';