Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a Windows Shortcut in WAMP www directory?

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.

like image 805
B Seven Avatar asked Jan 27 '12 17:01

B Seven


People also ask

How do I create a shortcut path?

Make a new shortcut to: cmd.exe /c start. Now right-click on it and get properties of the shortcut (shortcut tab). The full shortcut path should have been set to this: %windir%\system32\cmd.exe /c start .

Where are shortcuts located in Windows 10?

To view the location of the original file that a shortcut points to, right-click the shortcut and select "Open file location." Windows will open the folder and highlight the original file. You can see the folder path where the file is located in the top of the Windows Explorer window.

What is start in shortcut?

It just means that when you click a folder shortcut or shortcut to a program. then it looks in the exact folder first.


2 Answers

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.

like image 187
pjumble Avatar answered Oct 27 '22 09:10

pjumble


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.)

like image 41
Jonathan Avatar answered Oct 27 '22 09:10

Jonathan