Detect Apache version in apache config?
.htaccess, apache
Solution
A hack that I have used.
# Apache 2.2
<IfModule !mod_authz_core.c>
Satisfy Any
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
Problem
tl;dr: How do I do the following in a .conf or .htaccess file: ``` <IfApache22> # Do A </IfApache22> <IfApache24> # Do B </IfApache24> ``` Longer question: With Apache 2.4 the old Order get's deprecated in favor of Require. In my .htaccess files I have ``` <FilesMatch "\.(long|list|file|types)$"> Order allow,deny </FilesMatch> ``` which means Apache fails to start unless I enable access_compat. While doing so presents a useful workaround, I want a solution that works with both syntaxes as the config will be distributed to a lot of servers. The question is how I can detect the current version of Apache and apply the correct directive. I intend to use the file for a framework that is distributed to and used by a lot of people, and I can't control/guarantee that they have or lack any particular server setup, which is why I'd like the file to be 2.2/2.4 "agnostic".