mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
BUGFIX: Set absolute domain of 'main site' properly. (from r80951)
This commit is contained in:
parent
503ec12dd8
commit
e83287fd2d
@ -224,7 +224,10 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
|||||||
// Generate the existing absolute URL and replace the domain with the subsite domain.
|
// Generate the existing absolute URL and replace the domain with the subsite domain.
|
||||||
// This helps deal with Link() returning an absolute URL.
|
// This helps deal with Link() returning an absolute URL.
|
||||||
$url = Director::absoluteURL($this->owner->Link());
|
$url = Director::absoluteURL($this->owner->Link());
|
||||||
return preg_replace('/\/\/[^\/]+\//', '//' . $this->owner->Subsite()->domain() . '/', $url);
|
if($this->owner->SubsiteID) {
|
||||||
|
$url = preg_replace('/\/\/[^\/]+\//', '//' . $this->owner->Subsite()->domain() . '/', $url);
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,10 @@ class Subsite extends DataObject implements PermissionProvider {
|
|||||||
$domain = str_replace('.www.','.', $domain);
|
$domain = str_replace('.www.','.', $domain);
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubsiteID = 0 is often used to refer to the main site, just return $_SERVER['HTTP_HOST']
|
||||||
|
} else {
|
||||||
|
return $_SERVER['HTTP_HOST'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user