Skip to content

Commit 8057f17

Browse files
endelwaralrra
authored andcommitted
Make backup & source file blocking work with v2.3+
As of Apache v2.3, the `Order`, `Allow` & `Deny` directives are replaced by `Require`, making the Apache v2.2.x configuration not compatible with Apache v2.3+: http://httpd.apache.org/docs/trunk/upgrading.html#access. This patch enables the correct syntax for both Apache v2.2.x & v2.3+, by checking for the presence of the `mod_authz_core` base module (available only in Apache v2.3 and later). See also: http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html Close #5 and #6.
1 parent c571087 commit 8057f17

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

.htaccess

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,19 @@ AddDefaultCharset utf-8
306306
# danger when anyone has access to them.
307307

308308
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$">
309-
Order allow,deny
310-
Deny from all
311-
Satisfy All
309+
310+
# Apache < 2.3
311+
<IfModule !mod_authz_core.c>
312+
Order allow,deny
313+
Deny from all
314+
Satisfy All
315+
</IfModule>
316+
317+
# Apache ≥ 2.3
318+
<IfModule mod_authz_core.c>
319+
Require all denied
320+
</IfModule>
321+
312322
</FilesMatch>
313323

314324
# ------------------------------------------------------------------------------

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### HEAD
22

3+
* Fix backup and source file blocking for Apache v2.3+ ([#5](https://github.com/h5bp/server-configs-apache/issues/5)).
34
* Remove filename extension to content type mappings that are already provided by Apache v2.2.0+ ([#4](https://github.com/h5bp/server-configs-apache/issues/4)).
45
* Improve inline comments.
56
* Remove `screen flicker` fix required by IE 6 ([#3](https://github.com/h5bp/server-configs-apache/issues/3)).

0 commit comments

Comments
 (0)