Skip to content

Commit

Permalink
Use IfModule in .htaccess files for Apache 2.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Oct 30, 2013
1 parent e2b8bba commit a3dd461
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Code/.htaccess
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 5 additions & 0 deletions conf/.htaccess
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 5 additions & 0 deletions lib/.htaccess
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion lib/documenthelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
@@ -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.