diff --git a/.htaccess.dist b/.htaccess.dist
index 5724a6e04423c4d576e8745a7805397c23e70fbe..ec28dff859c08e79ef66282da0a85f3785ce9c19 100644
--- a/.htaccess.dist
+++ b/.htaccess.dist
@@ -6,8 +6,13 @@
 
 ## make sure nobody gets the htaccess, README, COPYING or VERSION files
 <Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
-    Order allow,deny
-    Deny from all
+    <IfModule mod_authz_host>
+        Require all denied
+    </IfModule>
+    <IfModule !mod_authz_host>
+        Order allow,deny
+        Deny from all
+    </IfModule>
 </Files>
 
 ## Uncomment these rules if you want to have nice URLs using
diff --git a/bin/.htaccess b/bin/.htaccess
index 281d5c33db37cd1cc887dbb2d36897b897835071..5f279f180699c2f115c326319a8afc645c5a7245 100644
--- a/bin/.htaccess
+++ b/bin/.htaccess
@@ -1,2 +1,7 @@
-order allow,deny
-deny from all
+<IfModule mod_authz_host>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_host>
+    Order allow,deny
+    Deny from all
+</IfModule>
diff --git a/conf/.htaccess b/conf/.htaccess
index bcc3ea0bdd29b4b55ef28f7b6a2deaf749fef3bd..b3ffca597c182a9be02a0fc4d58c6a7e7931200c 100644
--- a/conf/.htaccess
+++ b/conf/.htaccess
@@ -1,3 +1,8 @@
 ## no access to the conf directory
-order allow,deny
-deny from all
+<IfModule mod_authz_host>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_host>
+    Order allow,deny
+    Deny from all
+</IfModule>
diff --git a/data/.htaccess b/data/.htaccess
index 281d5c33db37cd1cc887dbb2d36897b897835071..5f279f180699c2f115c326319a8afc645c5a7245 100644
--- a/data/.htaccess
+++ b/data/.htaccess
@@ -1,2 +1,7 @@
-order allow,deny
-deny from all
+<IfModule mod_authz_host>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_host>
+    Order allow,deny
+    Deny from all
+</IfModule>
diff --git a/inc/.htaccess b/inc/.htaccess
index 2d9c357fff3ccc47d0bd6f9a232c2c2cb163ed01..2b34c725f6a5645d8c6e050513a364e76aecb939 100644
--- a/inc/.htaccess
+++ b/inc/.htaccess
@@ -1,3 +1,8 @@
 ## no access to the inc directory
-order allow,deny
-deny from all
+<IfModule mod_authz_host>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_host>
+    Order allow,deny
+    Deny from all
+</IfModule>
diff --git a/inc/lang/.htaccess b/inc/lang/.htaccess
index 2d69be754fc9e93b6ccfaffbe7a1e42cf553cd24..2aaae02fd59fedbb870d96bcee0feee5ac265e7e 100644
--- a/inc/lang/.htaccess
+++ b/inc/lang/.htaccess
@@ -1,3 +1,8 @@
 ## no access to the lang directory
-order allow,deny
-deny from all
+<IfModule mod_authz_host>
+    Require all denied
+</IfModule>
+<IfModule !mod_authz_host>
+    Order allow,deny
+    Deny from all
+</IfModule>