Multi-line Comments in Apache Configuration Files

Apache .conf files only really support single-line comments, starting with the pound sign (#). I came up with a silly hack for multi-line comments that seems to work, so I'm putting it out there either to help other people, or be brutally taken down by people who are more savvy than I am.

Basically, make up a non-existent runtime variable and use it in an <IfDefine> block. Because the variable doesn't exist, nothing between the tags should be executed. So for example:

<IfDefine IgnoreTheseDirectivesForNow>
        SetHandler fastcgi-script
        Options +ExecCGI

It certainly seems to work for my purposes. Is this a terrible idea, or a somewhat clever hack?

Comments are closed on this post to keep spammers at bay. If you want to chime in, please email or send a tweet.