Skip to content
Snippets Groups Projects
Commit a8f6a244 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #5759 from owncloud/fixing-5757-master

adding proper htaccess commands for Apache 2.4
parents 3428c03b b5e01397
No related branches found
No related tags found
No related merge requests found
......@@ -165,8 +165,19 @@ class OC_Setup {
}
public static function protectDataDirectory() {
$content = "deny from all\n";
$content.= "IndexIgnore *";
//Require all denied
$now = date('Y-m-d H:i:s');
$content = "# Generated by ownCloud on $now\n";
$content.= "# line below if for Apache 2.4\n";
$content.= "<ifModule mod_authz_core>\n";
$content.= "Require all denied\n";
$content.= "</ifModule>\n\n";
$content.= "# line below if for Apache 2.2\n";
$content.= "<ifModule !mod_authz_core>\n";
$content.= "deny from all\n";
$content.= "</ifModule>\n\n";
$content.= "# section for Apache 2.2 and 2.4\n";
$content.= "IndexIgnore *\n";
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content);
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/index.html', '');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment