Wednesday, November 10, 2010

How to change Document Root on WAMP

In this post we discuss how to change the www folder in apache based software wamp, which stands for Windows Apache, MySQL, PHP.

By default wamp’s www folder is C: \wamp\www. It means if you put a file on that folder for example test.html and enter address like this,

on the browser it will fetch your test.html page.

To change the default www folder we need to change the configuration file of apache which is httpd.conf (httpd stands for http daemon). Follow the steps given below:

  • Browse to the directory C:\Program Files\wamp\bin\apache\Apache2.2.11\conf

  • Open the file using a text editor i.e. notepad or notepad++ etc.
  • Search for the text ‘DocumentRoot’. You will see a line like this in the search result:
              DocumentRoot "C:/wamp/www"

  • Edit this line to your preferred directory where your web page files are stored. For example, D:\web
              DocumentRoot "D:/web/"

  • Again search for text ‘<Directory’
    On the second result you will see a line like this one:
              <Directory "C:/wamp/www/">

    You will have to change this one too.
              <Directory "D:/web/">

  • Now clicking wamp icon on the system tray restart all services.

Changes will take into effect soon after you refresh localhost pages.


  1. Thanks, man. It's always charming to see people that help each other out with those easy to read tutorials for a non profit purpose.

  2. You are welcome. We appreciate your nice comment.

  3. well done dude I found same tut every where but found best one here :)

  4. Hey, thanks a lot for visiting.

  5. Changed as advised and get 500 internal server error ..... :(

    1. Same for me.. is there anyway to fix it?

  6. Can you tell me some details of the problem? What steps did you follow to change document root?

    Are you using wamp and Windows?

  7. Sorry, I have changed as mentioned in the article.
    But the wamp icon color become orange, not reach into green, hence it is not working to me.
    Any further changes need to be done.. :)