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,
     http://localhost/test.html

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.

9 comments:

  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.

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

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

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

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

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

    Are you using wamp and Windows?

    ReplyDelete
  6. 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.. :)

    ReplyDelete
  7. Evolution Gaming Casinos - What is it, Why They Failed?
    Evolution Gaming is 블루 벳 먹튀 an online gaming 토토 배당률 software provider that was founded in 1999 and is 캔 토토 based out 야구분석 of Malta. The company is based in Malta, 파라오슬롯 which

    ReplyDelete