Setting and environment variable for one specific subdomain matching the ServerAlias

Discussion in 'Apache' started by mattalexx, Jan 5, 2011.

  1. #1
    I have a virtual host that includes the following settings

    ServerName www.host.com
    ServerAlias *.host.com​

    Can I set

    SetEnv FOO "bar"​

    for just a specific subdomain (like foo.host.com)?
     
    mattalexx, Jan 5, 2011 IP
  2. mattalexx

    mattalexx Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The answer is the `SetEnvIf` directive:

    SetEnvIf Host .*foo\.host\.com FOO=bar​
     
    mattalexx, Jan 5, 2011 IP