Portable harddisk detached from an alias

I have connected an external portable harddisk to the Apache server, and aliased its folder correctly.

But, if the harddisk or the drive is not available, apache stops (I mean, does not start the service). Is there a configuration to tell apache that:

  • If the aliased path is available, create the alias.
  • If not, skip creating the alias.
<IfModule alias_module>
# E: is an external drive
Alias /music E:
</IfModule>
<Directory "E:">
...
</Directory>

Also, a substituted drive (DOS SUBST command) does not seem to work. Any hints to run apache even if these configs remain in httpd.conf, while the drive is not available?

I don’t mind to stop service “/music” because I know that the drive is away.

As far as I know you can’t run Apache while you have missing paths in your configuration. My advice is to comment those lines by default and simply de-comment them when you attach your external drive + restart Apache. I think the only way you could what you want is creating an alias for a virtualdrive (CloneDrive, DaemonTools, MagicDisc etc) and mount ISO files in that drive whenever you want to change the content. It’s just that it’s impractical if you use your external drive to constantly change your content.

I have tried to falsified Apache by recreating the lost drive, using SUBST.
It does not seem to work.

subst E: c:\\
net start apache2.2

The missing drive E: is replaced with the contents from C:.
But the apache does not start.

Apparently Apache needs physical paths and subst only creates path mappings.