Skip to content

Commit

Permalink
somatonic#12 Fix bug with multiple domains and same root-key
Browse files Browse the repository at this point in the history
  • Loading branch information
Radon8472 committed Oct 26, 2021
1 parent 75f1172 commit 31916ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Multisite.module
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Multisite extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Multisite',
'version' => 12,
'version' => "0.1.3",
'summary' => 'Allows multiple sites with different domains run from single PW-site and database.',
'href' => 'https://github.com/somatonic/Multisite',
'singular' => true,
Expand Down Expand Up @@ -83,7 +83,7 @@ class Multisite extends WireData implements Module {

// set the current domain, so it can be picked up in templates or other modules
$this->domain = $httpHost;
$this->site = $this->domains[$httpHost];
$this->site = $this->domains[$httpHost];
$this->set404Page($this->domain);
$domainPageName = $this->domains[$httpHost]['root'];

Expand Down Expand Up @@ -257,6 +257,7 @@ class Multisite extends WireData implements Module {
$cleanIt = rtrim($this->it, "/");
$cleanIt = $cleanIt . "/";
$dfound = false;
$httpHost = strtolower(wire('config')->httpHost);

foreach($this->domains as $domain => $domainInfo) {

Expand All @@ -283,6 +284,7 @@ class Multisite extends WireData implements Module {
}

if($dfound) {
if($httpHost != $domain) continue;
if(strpos($this->it, $rootName . "/") !== false) {
$url = str_replace("{$rootName}/", '', $this->it);
} else {
Expand Down

0 comments on commit 31916ff

Please sign in to comment.