From 31916ff0e1d12a650365c01bd3d8636d09fd9ce9 Mon Sep 17 00:00:00 2001
From: Peter Gunold
Date: Tue, 26 Oct 2021 11:00:49 +0200
Subject: [PATCH 1/2] somatonic/Multisite#12 Fix bug with multiple domains and
same root-key
---
Multisite.module | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Multisite.module b/Multisite.module
index ba03831..2a0c9cd 100644
--- a/Multisite.module
+++ b/Multisite.module
@@ -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,
@@ -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'];
@@ -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) {
@@ -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 {
From fa929ec6652fe418d0082de07fd2ffcd0901dd38 Mon Sep 17 00:00:00 2001
From: Peter Gunold
Date: Wed, 8 Dec 2021 09:23:32 +0100
Subject: [PATCH 2/2] somatonic/Multisite#12 Fix rewriting urls for multiple
domains with same root
---
Multisite.module | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Multisite.module b/Multisite.module
index 2a0c9cd..aeb4d4b 100644
--- a/Multisite.module
+++ b/Multisite.module
@@ -156,8 +156,10 @@ class Multisite extends WireData implements Module {
if(!strlen($out)) return $out;
$protocol = $this->wire('config')->https ? 'https' : 'http';
+ $httpHost = strtolower(wire('config')->httpHost);
foreach($this->domains as $key => $domain){
+ if($httpHost != $key) continue;
if($this->modules->isInstalled("LanguageSupportPageNames")) {
foreach($this->languages as $lang) {