# How to Change the www root directory on WampServer

How can i change the root directory of the currently installed wampserver to some other directory.

• I reread this question because of the answers you are getting differ so much and I am a bit confused. Are you trying to use another version of WAMP (software install) in another directory or change the directory where the website is? Jan 24 '18 at 16:57
• The fact you accepted an answer answers my question. Cheers!! Jan 25 '18 at 16:56

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

1. Change DocumentRoot "c:/wamp/www" to DocumentRoot "c:/my/new/path" (Note slash direction). This will change the location where files are served from (~Line 230).
2. 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).
3. Copy all content from c:\wamp\www to your new directory (c:\my\new\path), including index.php
4. 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). • Thanks for this, I simply did steps 1 and 2 which was enough to get the localhost working. Aug 25 '15 at 21:22 • No problem @SverrirSigmundarson, the last two steps steps are so you can have the familiar wamp launch page with links to phpmyadmin and your project folders etc. Aug 26 '15 at 22:02 • Better done by creating Virtual Hosts Jun 15 '17 at 13:37 • If you do the 4th step, you have to change c:/wamp/scripts/config.inc.php:$configurationFile = 'c:/wamp/wampmanager.conf'; instead '../' and $wwwDir = 'c:/my/new/path'; instead '/www' Jan 8 '21 at 18:27 • And you have to make changes in add_vhost.php too, changin$server_dir to 'c:/wamp' Jan 8 '21 at 18:38

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.

And specifically: http://httpd.apache.org/docs/2.2/mod/core.html#directory

• I had a few syntax errors in my vhosts.conf (using \ instead of / in DocumentRoot paths) and the apache service wouldn't start. Basically WAMP doesn't tell you if you edited something wrong (syntax errors don't show up in log files), so I used httpd.exe -n wampapache64 -t to check and correct these errors (more details about this and port changing in here). Jun 5 '17 at 10:24
1. 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 \ 2. Click on Green Wamp Icon > Apache > httpd-vhosts.conf > Replace again the existing "www"-Directory with yours 3. Click on Green Wamp Icon > "Restart All Services" (Tested on Windows 10, Wampserver 3.0.6 64 Bit) • Better and correct answer than above one Oct 7 '19 at 7:47 I found these simple steps helping, 1. Click on WampServer icon in taskbar 2. Select Apache > httpd.conf from the pullup 3. Search for the term “DocumentRoot” 4. Change the DocumentRoot path to your custom directory 5. Search for your DocumentRoot path 6. again same procedure 7. Save your changes and “Restart All Services” • I have tried that but I get the Permission denied when I try to surf to localhost – user44905 Sep 20 '14 at 9:35 • @Max did you check whether there is any htaccess file in your new directory or project Sep 21 '14 at 8:46 After doing the above, you can also change the: in the of wamp directory (wampmanager.ini, wampmanager.conf). php.ini my.ini Save your changes and close Wampserver. • I tried doing this, but found that it got overwritten upon wamp restart. You can fix it for good by editing the$wwwDir variable in wamp/scripts/config.inc.php Feb 6 '14 at 20:08

I tried doing this, but found that it got overwritten upon wamp restart. You can fix it for good by editing the $wwwDir variable in wamp/scripts/config.inc.php And there is some more to do (WAMP version 3.0.6, 64bit) to avoid some other error-messages do following changes to the wamp/scripts/config.inc.php: Change all relative-paths to absolute-paths, like "../"-entries to eg. "c:/wamp64/" from $configurationFile = '../wampmanager.conf'


to

\$configurationFile = 'c:/wamp64/wampmanager.conf';


If 'c:/wamp64/' is your install-dir. Helped me a lot. Somewhere devs did a mess there ..

If the only thing that joesk needs is to have its www directory on another disk, you just have to create a virtual host using http://localhost/add_vhost.php?lang=english

• The OP is asking how to modify the configuration to point to another location. The OP has not asked about creating a new site or anything about another disk. The answer is to edit the configuration files and how. Your answer does not answer the question. Jan 23 '18 at 20:00
• I agree with closetnoc. This answer doesn't appear to address how to change the setting for the www directory. Jan 23 '18 at 20:52

You might better to create "Symlink" of the www folder from any place, without any need to change WAMP config.