1

On a test server, we use wildcards in the ServerAlias for dynamically generated sub domains.

Issue is i need to set a required custom environment called APP_HOME to be identical to the document_root.

<VirtualHost *:443>
    ServerName testserver.com
    ServerAlias *.testserver.com
    VirtualDocumentRoot = /var/www/branch/%1/
    SetEnv APP_HOME = /var/www/branch/%1/
</VirtualHost>

The expected result is for APP_HOME and DOCUMENT_ROOT to be the same, but currently

DOCUMENT_ROOT becomes /var/www/branch/testbranch/  

and

APP_HOME becomes /var/www/branch/%1/
Mohamed Salah
  • 959
  • 10
  • 40
Chris Shaw
  • 21
  • 4
  • [This](https://stackoverflow.com/questions/20671140/using-apache-config-and-htaccess-to-dynamically-set-config-vars-for-dev-and-prod) and [this](https://stackoverflow.com/questions/13568191/how-to-get-system-environment-variables-into-php-while-running-cli-apache2hand#_=_) may help – Rasa Mohamed Jun 13 '19 at 13:46
  • Thanls but neither help as neither handle dynamic content in the SetEnv – Chris Shaw Jun 13 '19 at 14:36

1 Answers1

1

This was never really resolved.

In the end we analysed the codebase and found that the custom enviroment variable was not needed and blanket replaced it with DOCUMENT_ROOT

One caveat was needing to ensure DOCUMENT_ROOT was set / passed in for cronjobs or cli operations.

Chris Shaw
  • 21
  • 4