Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We can use Apache's IfModule directive to test presence or absence of a specific module. Apache also allows nested IfModule directives which can be used to test multiple modules, in other words we can implement logic AND.

Is it also possible to implement logic OR? For example is it possible to use something similar to this:

<IfModule mod_php5.c OR sapi_apache2.c>
    # Some directives

Instead of this:

<IfModule mod_php5.c>
    # Some directives
<IfModule sapi_apache2.c>
    # Absolutely same directives with mod_php.c
share|improve this question

While it's not perfect, you could put the directives you want into a separate file, and then Include it in the relevant locations. I don't believe there's a way to do a logical OR in a single IfModule statement.

share|improve this answer
Although it's not perfect, it's definitely a solution. – Emre Yazici Jul 15 '11 at 12:09

<IfModule> sections are nest-able, which can be used to implement simple multiple-module tests.

Not sure since when it's available.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.