Change DocumentRoot without modifying httpd.conf

You can use a entirely different DocumentRoot for apache without actually modifying “httpd.conf”. 

Copy of your original DocumentRoot directory (/var/www/html) to a new temporary DocumentRoot directory (/var/www/alok). Create whatever files you want. 

STEP #1. Stop the apache (if it is running).

STEP #2. Give the command –
httpd -k start -c “DocumentRoot /var/www/html/alok”

STEP #3. Can check using browser. 

STEP #4. Stop the testing and go back to original settings.

# httpd -k stop
# apachectl start

Here is the screenshot from my machine.

Change DocumentRoot without modifying httpd.conf

Advertisements