public function getSubstitutedDomain()
    {
        $currentHost = $_SERVER['HTTP_HOST'];

        // If there are wildcards in the primary domain (not recommended), make some
        // educated guesses about what to replace them with:
        $domain = preg_replace('/\.\*$/', ".{$currentHost}", $this->Domain);

        // Default to "subsite." prefix for first wildcard
        // TODO Whats the significance of "subsite" in this context?!
        $domain = preg_replace('/^\*\./', "subsite.", $domain);

        // *Only* removes "intermediate" subdomains, so 'subdomain.www.domain.com' becomes 'subdomain.domain.com'
        $domain = str_replace('.www.', '.', $domain);

        return $domain;
    }