How to Change the www root directory on WampServer
For wamp 2.5 on Windows, use a text editor, e.g. notepad++ to edit c:\wamp\bin\apache\apache2.4.9\conf\httpd.conf
- Change
DocumentRoot "c:/wamp/www"
toDocumentRoot "c:/my/new/path"
(Note slash direction). This will change the location where files are served from (~Line 230). - Change
<Directory "c:/wamp/www">
to<Directory "c:/my/new/path">
(Note slash direction). This applies permissions from the old directory to the new one (~Line 252). - Copy all content from c:\wamp\www to your new directory (c:\my\new\path), including index.php
- Edit c:\my\new\path\index.php and change line 40
$server_dir = "../";
to$server_dir = "C:/wamp/";
This changes the location where config files etc. for wamp are read from. Change$suppress_localhost = false;
to correct projects links (~Line 30).
Edit the httpd.conf file and/or the vhosts.conf file for the site wish to change. The Directory directive will let you specify where the files for this site are to be located.
For more info on httpd.conf see: http://httpd.apache.org/docs/2.2/configuring.html
And specifically: http://httpd.apache.org/docs/2.2/mod/core.html#directory
- Click on Green Wamp Icon (Taskbar right Notification Icons) > Apache > httpd.conf > Replace all
${INSTALL_DIR}/www
with your directory. Take care to use/
instead of\
- Click on Green Wamp Icon > Apache > httpd-vhosts.conf > Replace again the existing "www"-Directory with yours
- Click on Green Wamp Icon > "Restart All Services"
(Tested on Windows 10, Wampserver 3.0.6 64 Bit)