diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index d3190bc..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 isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; + return Director::host(); } /** diff --git a/src/Model/SubsiteDomain.php b/src/Model/SubsiteDomain.php index a3aef03..aed9750 100644 --- a/src/Model/SubsiteDomain.php +++ b/src/Model/SubsiteDomain.php @@ -185,7 +185,7 @@ class SubsiteDomain extends DataObject */ public function getSubstitutedDomain() { - $currentHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; + $currentHost = Director::host(); // If there are wildcards in the primary domain (not recommended), make some // educated guesses about what to replace them with: