Reusable Adjusting Domains Template Code for Redirecting Non-SSL to SSL

This commit is contained in:
earnolmartin 2018-06-14 13:56:48 -06:00
parent 44c9cdca2e
commit fb110601cc

View file

@ -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{