How to use a Windows Shortcut in WAMP www directory?

15,129

Solution 1

Shortcuts in Windows have a .lnk extension so Apache doesn't know what to do with FollowSymLinks (because it's not a proper symlink).

I'd recommend either just using Aliases, e.g. in httpd.conf put:

Alias /other_projects "d:/other_projects/"

<Directory "d:/other_projects/">
   Options Indexes FollowSymLinks MultiViews
   Allow from all
</Directory>

Alternatively you can use an application to create proper sym links under windows (e.g. junction) which can be used like junction c:\wamp\www\other_projects d:\other_projects when you have FollowSymLinks enabled.

Solution 2

Following on from B Seven's comment: just go to your WAMP traybar icon, click on it and do the following:

Apache --> Alias directories --> Add an alias

Apache > alias directories > add an alias

This will pop up a terminal window to create the alias.

alias terminal window

Here you can enter in the subdirectory part name e.g. the site part in http://localhost/site and the path to your alias directory e.g. c:/projects/site, which you can copy from the Windows directory address bar and shift + insert into the terminal.

If you get a 403 Forbidden error (see this question) on browsing to your aliased directory, click on that alias directory from the WAMP UI and edit it such that:

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory> 

Resembles:

Alias /site/ "C:\projects\site/" 

<Directory "C:\projects\site/">
    Options Indexes FollowSymLinks MultiViews
    Require local
</Directory> 

And you're good to go. If it opens in one line, make sure you keep it in one line or WAMP won't be able to read the alias properly and come online. (Not sure why, maybe to do with incompatible line endings or something of the sort.)

Solution 3

You can do this By using the CMD mklink function.

Like(LINKFOLDER MOST NOT EXIST, IT WILL BE CREATED):

mklink /J LINKFOLDER ORIGINALFOLDER

OR include the path in quotes if it has spaces.

mklink /J "LINK FOLDER" "ORIGINAL FOLDER"

Successful output will be:

Junction created for LINKFOLDER <<===>> ORIGINALFOLDER
Share:
15,129

Related videos on Youtube

B Seven
Author by

B Seven

Status: Hood Rails on HTTP/2: Rails HTTP/2 Rack Gems: Rack Crud Rack Routing Capybara Jasmine

Updated on June 04, 2022

Comments

  • B Seven
    B Seven almost 2 years

    I want to run PHP files in the browser that are stored on a separate partition from the www folder in the WAMP folder. I created a shortcut and put it in the www folder, but got 404 error when I tried to browse the file localhost/directory-name/index.html.

    How do you set up shortcuts to other folders in the WAMP www folder on Windows XP?

    OK, after doing some research, I found FollowSymLinks needs to be set in the Apache config file. It includes Options Indexes FollowSymLinks, but still 404 error.

  • B Seven
    B Seven about 12 years
    OK, that makes sense. WAMP includes a tool (Apache->Alias directories->Add an alias. That worked great.
  • Dan
    Dan over 8 years
    You don't need an extra junction utility. Just run mklink /j <symlink name> <symlink target>...
  • David Spector
    David Spector almost 4 years
    "Not a proper symlink"?! Windows shortcuts (links) are as valid as "soft links" in Linux any day. Apache should be extended to handle Windows 10 as it is, even if you feel that Windows 10 has warts,
  • David Spector
    David Spector almost 4 years
    This worked for me to extend Dropbox out of its folder: C:\Web>mklink /H "C:\Web\HUON" "C:\Dropbox\Private\HUON"
  • ssavva05
    ssavva05 about 3 years
    Junction Confirmed Working