Virtual Directory in WAMP using Symbolic Link

You can setup a virtual directory in WAMP using Symbolic Link. You have to create a symbolic link in Windows using following command :

mklink /D [virtualDirectoryName] [TargetDirectory]

where,

/D indicates the target is a directory and not a file. If you don’t provide this then it will take file as target by default

[virtualDirectoryName] is the name of the virtual directory

[TargetDirectory] is the target directory to which you want to link the virtual directory

For example, if you want to create a site using name ‘mysite’ and you want to link this virtual directory to the directory ‘d:\somefolder\sitecontent’, then assuming the location of wamp as ‘c:\wamp\www’ you will create symbolic link as follows :

mklink /D c:\wamp\www\mysite d:\somefolder\sitecontent

I think it would be very useful to create virtual directory in wamp so that we would not have to put all the content into www directory of wamp.

2 Responses to this post.

  1. You can create virtual directory by other way as ::
    Right click on the task manager icon of the wamp.
    Go to Alias Directories.
    Click on add alias.
    Enter name of virtual directory – alias.
    Enter the directory path where you want to link virtual directory.

    Reply

  2. [...] have to "create" the symbolic link to the virtual directory in Windows. http://nareshkhokhani.wordpress.com/2008/05/21/virtual-directory-in-wamp-using-symbolic-link/ Also be sure you set the Document Root directory correctly. [...]

    Reply

Respond to this post