Hack 77. Use a temporary DocumentRoot without modifying httpd.conf

This is very helpful, when you are trying out different layout for your website and don’t want to modify the original files under the default DocumentRoot.

Take a copy of your original DocumentRoot directory (/var/www/html) to a new temporary DocumentRoot directory (/var/www/html_debug). Make all your changes under this temporary DocumentRoot directory (/var/www/html_debug) and start the Apache with this temporary directory as shown below using option -c.

# httpd -k start -c “DocumentRoot /var/www/html_debug/”

If you want to go back to original configuration using the default DocumentRoot (/var/www/html), simply restart the Apache as shown below.

# httpd -k stop
# apachectl start