remove trailing slash on hostnames for redirect as apache's mod_rewrite appends a second, fixes #658

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2011-03-14 08:02:58 +01:00
parent 2f0a717241
commit eaee62db4d

View File

@@ -767,12 +767,15 @@ 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);
}
// 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 (.*) '. $this->idnaConvert->encode($domain['documentroot']).'%{REQUEST_URI}'. "\n";
$vhost_content.= ' RewriteRule (.*) '. $corrected_docroot.'%{REQUEST_URI}'. "\n";
$vhost_content.= ' </IfModule>' . "\n";
$code = getDomainRedirectCode($domain['id']);