Skip to content

Commit

Permalink
Update StaticpagesController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
michelsteege authored Apr 30, 2018
1 parent c442298 commit 59468e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Controllers/StaticpagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ public function transformURL($url)
}
$parts = parse_url($url);
//Fix url for subsites
$newURL = str_replace($parts['host'], $_SERVER['HTTP_HOST'], $url);
$httpHost = $_SERVER['HTTP_HOST'];
if(class_exists('SilverStripe\Subsites\Model\Subsite')){

$httpHost = \SilverStripe\Subsites\Model\Subsite::currentSubsite()->domain();
}
$newURL = str_replace($parts['host'], $httpHost, $url);

//Create path
$path = Director::baseFolder() . '/' . $this->_cachepath . '/' . $_SERVER['HTTP_HOST'] . $parts['path'];
$path = Director::baseFolder() . '/' . $this->_cachepath . '/' . $httpHost . $parts['path'];
$this->_paths[$url] = [
'path' => $path,
'url' => $newURL
Expand Down

0 comments on commit 59468e8

Please sign in to comment.