diff --git a/config/.htaccess b/config/.htaccess index 853aed187d3e7..13ca28758cfa4 100644 --- a/config/.htaccess +++ b/config/.htaccess @@ -1,14 +1,25 @@ -# line below if for Apache 2.4 - -Require all denied - +# Section for Apache 2.4 to 2.6 + + Require all denied + + + Order Allow,Deny + Deny from all + Satisfy All + -# line below if for Apache 2.2 - -deny from all - +# Section for Apache 2.2 + + + + Order Allow,Deny + Deny from all + + Satisfy All + + -# section for Apache 2.2 and 2.4 - -IndexIgnore * - +# Section for Apache 2.2 to 2.6 + + IndexIgnore * + diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 4ebd561818925..32a85264f578a 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -553,19 +553,29 @@ public static function protectDataDirectory() { //Require all denied $now = date('Y-m-d H:i:s'); $content = "# Generated by Nextcloud on $now\n"; - $content .= "# line below if for Apache 2.4\n"; - $content .= "\n"; - $content .= "Require all denied\n"; - $content .= "\n\n"; - $content .= "# line below if for Apache 2.2\n"; - $content .= "\n"; - $content .= "deny from all\n"; - $content .= "Satisfy All\n"; - $content .= "\n\n"; - $content .= "# section for Apache 2.2 and 2.4\n"; - $content .= "\n"; - $content .= "IndexIgnore *\n"; - $content .= "\n"; + $content .= "# Section for Apache 2.4 to 2.6\n"; + $content .= "\n"; + $content .= " Require all denied\n"; + $content .= "\n"; + $content .= "\n"; + $content .= " Order Allow,Deny\n"; + $content .= " Deny from all\n"; + $content .= " Satisfy All\n"; + $content .= "\n\n"; + $content .= "# Section for Apache 2.2\n"; + $content .= "\n"; + $content .= " \n"; + $content .= " \n"; + $content .= " Order Allow,Deny\n"; + $content .= " Deny from all\n"; + $content .= " \n"; + $content .= " Satisfy All\n"; + $content .= " \n"; + $content .= "\n\n"; + $content .= "# Section for Apache 2.2 to 2.6\n"; + $content .= "\n"; + $content .= " IndexIgnore *\n"; + $content .= ""; $baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); file_put_contents($baseDir . '/.htaccess', $content);