Skip to content

Commit 231ecf8

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 231ecf8

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.htaccess

+11-3
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,17 @@ 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+
# Apache < 2.3
310+
<IfModule !mod_authz_core.c>
311+
Order allow,deny
312+
Deny from all
313+
Satisfy All
314+
</IfModule>
315+
316+
# Apache ≥ 2.3
317+
<IfModule mod_authz_core.c>
318+
Require all denied
319+
</IfModule>
312320
</FilesMatch>
313321

314322
# ------------------------------------------------------------------------------

CHANGELOG.md

+1
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)