Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with multiple domains and same root-key #13

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 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 @@ -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) {
Expand Down Expand Up @@ -257,6 +259,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 +286,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