views:

17

answers:

1

Is there a way to include configuration settings in Apache based on if a directory exists? Basically I have a portable hard drive that I transport between work and home that has some stuff I'm developing on it. I only want the Apache config to load a particular virtual host if the folder exists.

A: 

No, there seems to be no direct way to do this.

The only thing that might be a solution is the IfDefine directive. You can define defines using the -d parameter to when the server is started.

The parameter-name argument is a define as given on the httpd command line via -Dparameter-, at the time the server was started.

You might be able to check for the existence of a directory in a batch or bash file, and set the -d parameter accordingly.

Whether that is an option, will depend on how your server is started from the portable hard drive.

Pekka