Are Apache httpd Define directive variables intended to be allowed to be overwritten?

For example,

Define SITE example1.com

<VirtualHost *:80>
    ServerName ${SITE}

Define SITE example2.com

<VirtualHost *:80>
    ServerName ${SITE}

It seems to be working, my SITE variables are being overwritten, but I won't put it into production if it's not intended to be used this way.

Looking for a canonical answer, if possible. Here's another link to more obscure docs for mod_define.

  • Since the Define variable is intended to have the same behaviour as passing the variable with a -D command line argument I would advise against relying on this behaviour.
    – Bob
    Dec 20, 2021 at 14:37
  • Thanks Bob, I think you're probably right. If you want to post a quick answer to backup the logic, I'll mark it as both canonical and correct since there is no documentation available to the contrary.
    – Jeff
    Dec 20, 2021 at 14:41

1 Answer 1


Sure they can be overwritten like the content of any global variable. Since of its global scope you just need to keep an eye on the order of its definition and use. E.g. -DSITE=bla is like having the related Define statement at the beginning of your httpd config - there is nothing wrong with it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .