简体   繁体   中英

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!

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM