Forum Moderators: phranque
I am running Apache 2.0.54 on WinXP and am trying to set an alias to the URL [localhost...] to point to the root of drive G ... basically, when someone is on my server, and types in "/usb/", they can access the files on my USB drive as if it were in the doc root. I got this to work just fine, but the problem comes when I take the usb drive with me somewhere [therefore un-mounting it], and as a result Apache eventually shuts down .... which is no good.
Here is the code I am currently using:
Alias /usb/ "G:/"
<Directory "G:/">
Options All
AllowOverride All
</Directory>
I guess my question is, is there some logic for conf files that could check if the drive is there? And if so, link to it, otherwise just ignore it?
Thanks!
Create a directory on another drive, let's say C:\, and let's call it USB. Then, go to the Control Panel-> Administrative Tools-> Computer Management-> Disk Management. If you right-click on the G:\ drive, and choose "Change Drive Letter and Path", then click on Change, do you have the option to "mount on the following empty NTFS directory"? If so, mount it on C:\USB\. If not, then this was a whole waste of time :)
If it does work then change the path in your Apache config to point to this directory, instead of the G:\ drive. Like I said, it's probably not the best way, but it might be something to try.
Though, instead of hitting "Change" I "added" an alias to it. If that makes sense.
Just make sure you add the forward slash / to the end of your windows path, otherwise you'll get 404's:
Alias /usb/ "C:/apache/usb/"
<Directory "C:/apache/usb/">
Options All
AllowOverride All
</Directory>
Thanks for all your help!