If you need to close some directory in .htaccess (we assume overrides are allowed in this directory with AllowOverride), you can use in .htaccess:
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
- Apache 2.4 (with mod_authz_core) → will use
Require all denied
- Apache 2.2 (no mod_authz_core) → will use
Deny from all
Why?
In Apache 2.4.0 the directive
Deny from all
has become deprecated (source).