Skip to content
Snippets Groups Projects
Commit 3bce1b20 authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Add DirectorySlash to dynamic .htaccess write

When `DirectorySlash off` is set then Apache will not lookup folders anymore. This is required for example when we use the rewrite directives on an existing path such as  `/core/search`. By default Apache would load `/core/search/` instead `/core/search` so the redirect would fail here.

This leads however to the problem that URLs such as `localhost/owncloud` would not load anymore while `localhost/owncloud/` would. This has caused problems such as https://github.com/owncloud/core/pull/21015

With this change we add the `DirectorySlash off` directive only when the `.htaccess` is writable to the dynamic part of it. This would also make `localhost/owncloud` work again as it would trigger the 404 directive which triggers the redirect in base.php.
parent b15d77c9
No related branches found
No related tags found
No related merge requests found
...@@ -50,9 +50,6 @@ ...@@ -50,9 +50,6 @@
# Rewrite rules for `front_controller_active` # Rewrite rules for `front_controller_active`
Options -MultiViews Options -MultiViews
<IfModule mod_dir.c>
DirectorySlash off
</IfModule>
RewriteRule ^core/js/oc.js$ index.php/core/js/oc.js [PT,E=PATH_INFO:$1] RewriteRule ^core/js/oc.js$ index.php/core/js/oc.js [PT,E=PATH_INFO:$1]
RewriteRule ^core/preview.png$ index.php/core/preview.png [PT,E=PATH_INFO:$1] RewriteRule ^core/preview.png$ index.php/core/preview.png [PT,E=PATH_INFO:$1]
RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff)$ RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff)$
......
...@@ -439,6 +439,9 @@ class Setup { ...@@ -439,6 +439,9 @@ class Setup {
$content.="\n RewriteBase ".$webRoot; $content.="\n RewriteBase ".$webRoot;
$content .= "\n <IfModule mod_env.c>"; $content .= "\n <IfModule mod_env.c>";
$content .= "\n SetEnv front_controller_active true"; $content .= "\n SetEnv front_controller_active true";
$content .= "\n <IfModule mod_dir.c>";
$content .= "\n DirectorySlash off";
$content .= "\n </IfModule>";
$content.="\n </IfModule>"; $content.="\n </IfModule>";
$content.="\n</IfModule>"; $content.="\n</IfModule>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment