Forum Moderators: phranque

Message Too Old, No Replies

mod_alias, Directory question

         

pureform

6:08 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I have searched the forums and couldn't find anything on this, so here goes nothing.

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!

ChadSEO

7:43 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I'm not sure if this would work, or is even the best way, but it's something you could try.

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.

pureform

9:49 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



Shortly after I posted this question I thought about doing something like that, but wasn't sure where to start ... I'll give it a try though ...

Thanks!

pureform

1:58 am on Aug 5, 2005 (gmt 0)

10+ Year Member



Success!

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!