Skip to content
Permalink
Browse files

Use IfModule in .htaccess files for Apache 2.4.

  • Loading branch information...
kohler committed Oct 30, 2013
1 parent e2b8bba commit a3dd461422e208b4a3f57e1b62d8a77e81805434
Showing with 30 additions and 1 deletion.
  1. +5 −0 Code/.htaccess
  2. +9 −0 README.md
  3. +5 −0 conf/.htaccess
  4. +5 −0 lib/.htaccess
  5. +1 −1 lib/documenthelper.php
  6. +5 −0 src/.htaccess
@@ -1,2 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
@@ -94,6 +94,15 @@ directory. For example, this section of httpd.conf makes the
</Directory>
Alias /testconf /home/kohler/hotcrp

Apache 2.4 or later requires this instead.

<Directory "/home/kohler/hotcrp">
Options Indexes Includes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
Alias /testconf /home/kohler/hotcrp

Note that the first argument to Alias should NOT end in a slash. The
"AllowOverride all" directive is required.

@@ -1,2 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
@@ -1,2 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
@@ -251,7 +251,7 @@ private static function _store_filestore($fsinfo, $doc) {
// filestore directory
$htaccess = "$fdir/.htaccess";
if (!is_file($htaccess)
&& file_put_contents($htaccess, "Order deny,allow\nDeny from all\nphp_flag magic_quotes_gpc off\n") === false) {
&& file_put_contents($htaccess, "<IfModule mod_authz_core.c>\nRequire all denied\n</IfModule>\n<IfModule !mod_authz_core.c>\nOrder deny,allow\nDeny from all\n</IfModule>\n") === false) {
@unlink("$fdir/.htaccess");
return false;
}
@@ -1,2 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>

0 comments on commit a3dd461

Please sign in to comment.
You can’t perform that action at this time.