Most Apache and PHP setups expect all
DocumentRoot folders to exist under a certain path, that already has PHP, directory permissions, security, and other configurations implemented and enabled under it (via httpd.conf and included *.conf files). Normally, placing a website outside this path would require more then just updating the VirutalHost’s
DocumentRoot path, but also re-implementing all those other configurations for the new location in the website’s VirtualHost file.
Luckily, under Windows there is an easier way to accomplish the above by simply using “Junction Points”, and linking out of the normal
DocumentRoot folder to whatever other location (folder) you’d like (using something very similar to Linux’s
For example, under WampDeveloper Pro this structure is used:
1. All websites are contained under folder:
2. A website’s
DocumentRoot folder is of the form:
3. PHP is enabled under all paths of the form:
Without modifying or adding to the existing configuration, you can use an NTFS “Junction Point” to make a link between an outside folder and either the website’s entire containing folder or the website’s “\webroot” (
To change a website’s DocumentRoot folder -
Create an NTFS “Junction Point” from the website’s “\webroot” folder to the real location:
1. Remove (delete) the website’s existing DocumentRoot folder:
2. Then from the command line (WampDeveloper’s System Tab, Command Line button) execute (all on one line):
mklink /j C:\WampDeveloper\Websites\www.example.com\webroot D:\Sites\www.example.com\
D:\Sites\www.example.com\ has to already exist.
3. Do not modify the VirtualHost with the new path; everything remains as-is.
This way you’ll have your real
D:\Sites\www.example.com\ folder (where the files reside) and a link to that folder from
C:\WampDeveloper\Websites\www.example.com\webroot (which is what WampDeveloper and its configuration will operate through).
“Junction Points” only work between local drives of the system and OS (between local volumes), and will not link to networked drives or remote shares.
It is also not usually possible to directly link the folders of websites, nor the database folder, to a NAS device.
To use network shares, you would need to change Apache’s account from “LocalSystem” to an account that has network share access. Under Windows, while “LocalSystem” can access TCP/IP, it does not have permissions to access network shares.
Non-local file system access can significantly slow down Apache.