From df8b851f538a5571e21ca2bf7e3ad7464f3a01c5 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 26 Apr 2016 13:18:18 +0200 Subject: [PATCH] Don't write empty RewriteBase ownCloud may be configured to live at the root folder without a trailing slash being specified. In this case manually set the rewrite base to `/` --- lib/private/setup.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/private/setup.php b/lib/private/setup.php index d2f3802eba..196ae8a8bc 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -427,10 +427,18 @@ class Setup { //custom 404 error page $content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php"; + // ownCloud may be configured to live at the root folder without a + // trailing slash being specified. In this case manually set the + // rewrite base to `/` + $rewriteBase = $webRoot; + if($webRoot === '') { + $rewriteBase = '/'; + } + // Add rewrite base $content .= "\n"; $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]"; - $content .= "\n RewriteBase ".$webRoot; + $content .= "\n RewriteBase ".$rewriteBase; $content .= "\n "; $content .= "\n SetEnv front_controller_active true"; $content .= "\n ";