Skip to content

Commit

Permalink
.htaccess files: support Apache 2.4+ syntax
Browse files Browse the repository at this point in the history
If `mod_version` is enabled, the previous syntax will apply for Apache <2.4.
If not, the new syntax is used by default.

Fixes shaarli#676

`mod_version` identifier is `version_module` across all Apache versions. See:

  * https://httpd.apache.org/docs/current/mod/mod_version.html
  * https://httpd.apache.org/docs/2.2/mod/mod_version.html
  * https://serverfault.com/questions/733910/how-do-i-load-mod-version-only-if-it-isnt-built-in-to-apache

Note that version_module comes built-in with Debian (and derivatives) Apache2 packages, see https://wiki.debian.org/Apache/PackagingFor24
  • Loading branch information
ArthurHoaro committed Nov 8, 2016
1 parent 849d165 commit 5ebc1d5
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 14 deletions.
15 changes: 13 additions & 2 deletions application/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions cache/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions data/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions docker/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions pagecache/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions tests/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>
15 changes: 13 additions & 2 deletions tmp/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Allow from none
Deny from all
<IfModule version_module>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Allow from none
Deny from all
</IfVersion>
</IfModule>

<IfModule !version_module>
Require all denied
</IfModule>

0 comments on commit 5ebc1d5

Please sign in to comment.