Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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

share|improve this answer

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).
share|improve this answer
Thanks for this, I simply did steps 1 and 2 which was enough to get the localhost working. – Sverrir Sigmundarson 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. – danialk Aug 26 '15 at 22:02

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 again for “DocumentRoot”

  6. again same procedure

  7. Save your changes and “Restart All Services”

share|improve this answer
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 – Prasanth K C 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.

share|improve this answer
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 – Kevin Higgins Feb 6 '14 at 20:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.