Apache Network Drive Alias

14,459

Solution 1

You need to use forward slashes instead of backslashes or escape them all using an additional backslashas well as enclosing the paths in quotes as stated by Xophmeister. Eg:

Alias /p "//ps-file.server_location.edu/A$/"
<Directory "//ps-file.server_location.edu/A$/">
Order allow,deny
Allow from all
</Directory>

or

Alias /p "\\\\ps-file.server_location.edu\\A$\\"
<Directory "\\\\ps-file.server_location.edu\\A$\\">
Order allow,deny
Allow from all
</Directory>

You are correct to use a UNC path unless you create a mapped drive in the user profile being used to run the apache service.

Solution 2

caltor is right , little edit here , you can use <Directory "/p"> cause it has alias.But I hate writing network drive in config like //p... also

There is another problem occurs here , in this method , you cannot execute exec() or batch file , cannot take the information of directory , open_dir etc cannot return a result , also apache cannot start as a service . To solve that,

First of all download http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx Extract zip file to C:/sys. Open cmd , and

cd c:/sys (enter)
psexec -i -s cmd.exe

then a new command line appears . All you need

net use j: \\lethea\sharedfolder /persistent:yes

will ask username and password of lethea pc . Here is j: the short name of the network drive . After doing this , in httpd.conf folder you dont need to create alias or write full network map to Documentroot and directory

Documentroot = "j:/mywww"  #referencing \\lethea\sharedfolder\mywww
<Directory "j:/mywww">

...

Share:
14,459
SortingHat
Author by

SortingHat

Updated on June 26, 2022

Comments

  • SortingHat
    SortingHat about 2 years

    I've searched through stackoverflow for a similiar problem, but none of the solutions seem to work.

    I'm running WAMP and have a network drive T:\ which I want to use as an alias in Apache. So far I have added:

    Alias /p \\ps-file.server_location.edu\A$
    < Directory /p>
    Order allow,deny
    Allow from all
    < / Directory>

    However, whenever I try to access localhost/p I get a 403 forbidden message saying You don't have permission to access /p on this server. Any suggestions?

    I have tried changing the logon settings in services.msc, but this stops apache from starting all together.

    EDIT: I also have to enter my login information for the network drive the first time I connect it. Can I somehow give apache my login information?

  • SortingHat
    SortingHat almost 13 years
    If I use "T:\" I get a directory not found error, and if I use T:\ apache doesn't even start. The network drive I have mapped also requires a logon which I know plays into this, but I don't know exactly how
  • Xophmeister
    Xophmeister almost 13 years
    Try T:/, instead. You may also need to enquote the path: "T:/".
  • theINtoy
    theINtoy about 11 years
    On Windows 8, I had to run the cmd as a Adminsitrator. If you have a cmd window task on the task bar, right click, then right click Command Prompt, click run as adminsitrator