apacheif-statementhttp-headersvhosts

Apache If condition - HTTP Header Param


I have a question about an condition into vhost rules. I need to add and IncludeOptional redirects files only if a specific param into the header is present.

I think that I can do something like:

<If "%{HTTP:X-block-redirect} in { 'false' }">
 IncludeOptional ...
</If>

but I still think that i'm missing something. For example, If the block-redirect is not present (or it's false like my If condition), it should add the IncludeOptional files but if it's true it shouldn't.

I think that a condition that match something like:

<If "%{HTTP:X-block-redirect} **not** in { 'true' }"> 
...
</If>

can work better but I'm struggling on how to create an if like "if NOT this DO that"... Can you help me?

Thanks a lot!


Solution

  • In order to resolve this I've just used a single (and simple) !='true' condition.

    <If "%{HTTP:X-value} !='true'">
     IncludeOptional ...
    </If>
    

    I thought I could not check a single value instead of an array of values, but I was wrong.

    I hope this solution can help someone else with similar problems!