diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index 229604d..2bcdbff 100644 --- a/src/Model/Subsite.php +++ b/src/Model/Subsite.php @@ -870,7 +870,7 @@ class Subsite extends DataObject } // If there are no objects, default to the current hostname - return $_SERVER['HTTP_HOST']; + return Director::host(); } /** diff --git a/src/Model/SubsiteDomain.php b/src/Model/SubsiteDomain.php index 66432e9..aed9750 100644 --- a/src/Model/SubsiteDomain.php +++ b/src/Model/SubsiteDomain.php @@ -185,7 +185,7 @@ class SubsiteDomain extends DataObject */ public function getSubstitutedDomain() { - $currentHost = $_SERVER['HTTP_HOST']; + $currentHost = Director::host(); // If there are wildcards in the primary domain (not recommended), make some // educated guesses about what to replace them with: