Changing the root folder that apcahe points to

by rajesh 2007-06-08 07:18:39

Document Root: DocumentRoot is the directory out of which you will serve your documents. i.e this is the folder from where the files and folders will be listed when you type http://localhost or http://domain-name in your browser. By default, all requests are taken from this directory.

For example if you have installed apache under "C:\Program Files\Apache\Apache2.2" (Windows) folder or say "/etc/httpd/" (Linux) folder. Files will be serverd from "C:\Program Files\Apache Group\Apache2.2\htdocs" (Windows) or "/etc/httpd/htdocs/" (Linux) folder.

You can change this default document root value to point a different folder by editing the httpd.conf file present under the /conf folder

E.g: Where httpd.conf will be present?
[in Windows]
C:\Program Files\Apache\Apache2.2\conf/httpd.conf

[in Linux]

After editing the file search for "DocumentRoot" and change the line to point to new folder

E.g: For Windows
DocumentRoot E:/temp

E.g: For Linux
DocumentRoot /home/test

Note: Please make a note that there is no ending slash. If you want to point to temp folder user E:/temp and not E:/temp/

After the above change is search for the line that starts as <Directory and contains the default documentroot value.

Replace the default value with the same value you have changed for DocumentRoot

[in Windows]
<Directory "E:/temp">

[in Linux]
<Directory "/home/test">

You must LOGIN to add comments