Home / VPS & Dedicated / Apache's DocumentRoot directive

Apache's DocumentRoot directive

Apache directives
Apache HTTP Server gives you the flexibility to decide where you want to store the web-accessible files for your websites. Most operating systems have their own unique directory structure for their default web server installations, but even those can be changed. The Apache default document root is /usr/local/apache/htdocs.

To change the document root, use the following directive in your httpd.conf or virtual host configuration file:

DocumentRoot directory-path

Replace “directory-path” with the path you want to use. For example:

DocumentRoot /var/www/public_html

Make sure you do not have a trailing slash. With this setup, a file, such as index.html, found in /var/www/public_html/index.html will appear on the web at: http://www.yourdomain.com/index.html. Whatever directory you choose must be readable (but not writable) by outside users.

Source: Apache.org

Check Also

servers

Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …