From fb110601ccc79f15f91c883629b54d7ebfa761f6 Mon Sep 17 00:00:00 2001 From: earnolmartin Date: Thu, 14 Jun 2018 13:56:48 -0600 Subject: [PATCH] Reusable Adjusting Domains Template Code for Redirecting Non-SSL to SSL --- ehcp/classapp.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ehcp/classapp.php b/ehcp/classapp.php index e5e36f1..1f27890 100755 --- a/ehcp/classapp.php +++ b/ehcp/classapp.php @@ -13164,7 +13164,7 @@ function getStripNonSSLSectionForDomain($sslInfo, $stripSSLSectionFromTemplate){ return $stripNonSSLSectionFromTemplate; } -function adjustDomainTemplateDependingOnSSLSettings($webserver_template, $ar1, $type = 'domain', $echoOn = true){ +function adjustDomainTemplateDependingOnSSLSettings($webserver_template, &$ar1, $type = 'domain', $echoOn = true){ $sslInfo = $this->getSSLSettingForDomain($ar1['domainname']); $stripSSLSectionFromTemplate = $this->getStripSSLSectionForDomain($sslInfo); $stripNonSSLSectionFromTemplate = $this->getStripNonSSLSectionForDomain($sslInfo, $stripSSLSectionFromTemplate); @@ -13194,6 +13194,12 @@ function adjustDomainTemplateDependingOnSSLSettings($webserver_template, $ar1, $ $httpOnlyRedirect = str_replace("{domainname_redirect}", "https://{domainname_redirect}", $httpOnlyRedirect); $ar1['domainname_redirect'] = $ar1['domainname']; + if($type == "subdomain"){ + // Gotta use the subdomain here + $httpOnlyRedirect = str_replace("{domainname}", "{subdomain}.{domainname}", $httpOnlyRedirect); + $ar1['domainname_redirect'] = $ar1["subdomain"]; + } + if($this->miscconfig['webservertype'] == "nginx"){ $ar1['domainname_redirect'] = '$host'; }else{