From eaee62db4dd66463f6a913f893f99342c1ebc876 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Mon, 14 Mar 2011 08:02:58 +0100 Subject: [PATCH] remove trailing slash on hostnames for redirect as apache's mod_rewrite appends a second, fixes #658 Signed-off-by: Michael Kaufmann (d00p) --- scripts/jobs/cron_tasks.inc.http.10.apache.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index ffcfab92..ed63fbaa 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -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.= ' '."\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.= ' ' . "\n"; $code = getDomainRedirectCode($domain['id']);