Changing Apache's www root directory

Sometimes it's necessary to change your current www root folder to something else. Maybe you have all your work files on a different partition than where you installed WAMP to or you have several websites you're working on and need to make one of them your primary site for a while (the one that shows up when entering localhost).

Anything that has to do with Apache configuration can be done within a file called httpd.conf.

1. WAMP provides quick access to certain important files, one of them being httpd.conf.
2. Left-click WAMP icon and select Config files › httpd.conf.
3. The file will probably open up in Notepad.
4. Press Ctrl+F and enter documentroot.
5. Make sure case sensitive search is disabled and hit enter.
6. You should find a line that looks like DocumentRoot "C:/Program Files/wamp/www/".
7. Copy that line then put a # in front of it: #DocumentRoot "C:/Program Files/wamp/www/".
8. Paste the copied line just below and adjust it to where your custom root folder is located (e.g. DocumentRoot "C:/my_cool_site/").
9. Resume the search (usually by pressing F3) and you'll find a line like: .
10. Again copy the line, put a # in front, paste copied line below and adjust it (e.g. ).
11. Save and close the file.

Whenever you make a change to httpd.conf you have to restart Apache for it to take effect. The # we've added in front of the old lines turns them into a comment which Apache ignores. We just added them so that we can easily switch back to an old configuration by uncommenting the lines.

1. Left-click the WAMP icon and select Apache › Restart Service.
2. Wait for the icon status to change to white again.

The root directory should now have changed to then one you've entered in httpd.conf. You can test this by entering localhost in your web browser. The index page in that folder (or the lack thereof) should show up now.