Fix bug: with a SSL-enabled domain and redirect Apache won't start

This commit is contained in:
anbrosius
2012-07-25 17:09:44 +02:00
parent 607cbded7d
commit 38b7d46596

View File

@@ -766,32 +766,6 @@ class apache
$domain['documentroot'] = 'https://' . $domain['domain'] . '/';
}
if(preg_match('/^https?\:\/\//', $domain['documentroot']))
{
$corrected_docroot = $this->idnaConvert->encode($domain['documentroot']);
if(substr($corrected_docroot, -1) == '/') {
$corrected_docroot = substr($corrected_docroot, 0, -1);
}
/* Get domain's redirect code */
$code = getDomainRedirectCode($domain['id']);
$modrew_red = '';
if ($code != '') {
$modrew_red = '[R='. $code . ';L]';
}
// redirect everything, not only root-directory, #541
$vhost_content.= ' <IfModule mod_rewrite.c>'."\n";
$vhost_content.= ' RewriteEngine On' . "\n";
$vhost_content.= ' RewriteCond %{HTTPS} off' . "\n";
$vhost_content.= ' RewriteRule (.*) '. $corrected_docroot.'%{REQUEST_URI} ' . $modrew_red . "\n";
$vhost_content.= ' </IfModule>' . "\n";
$code = getDomainRedirectCode($domain['id']);
$vhost_content.= ' Redirect '.$code.' / ' . $this->idnaConvert->encode($domain['documentroot']) . "\n";
}
else
{
if($ssl_vhost === true
&& $domain['ssl'] == '1'
&& $this->settings['system']['use_ssl'] == '1')
@@ -840,6 +814,32 @@ class apache
}
}
if(preg_match('/^https?\:\/\//', $domain['documentroot']))
{
$corrected_docroot = $this->idnaConvert->encode($domain['documentroot']);
if(substr($corrected_docroot, -1) == '/') {
$corrected_docroot = substr($corrected_docroot, 0, -1);
}
/* Get domain's redirect code */
$code = getDomainRedirectCode($domain['id']);
$modrew_red = '';
if ($code != '') {
$modrew_red = '[R='. $code . ';L]';
}
// redirect everything, not only root-directory, #541
$vhost_content.= ' <IfModule mod_rewrite.c>'."\n";
$vhost_content.= ' RewriteEngine On' . "\n";
$vhost_content.= ' RewriteCond %{HTTPS} off' . "\n";
$vhost_content.= ' RewriteRule (.*) '. $corrected_docroot.'%{REQUEST_URI} ' . $modrew_red . "\n";
$vhost_content.= ' </IfModule>' . "\n";
$code = getDomainRedirectCode($domain['id']);
$vhost_content.= ' Redirect '.$code.' / ' . $this->idnaConvert->encode($domain['documentroot']) . "\n";
}
else
{
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
$vhost_content.= $this->getWebroot($domain);
if ($this->_deactivated == false) {