* Initially you will need to create a new directory where you want Apache to point to for its default web content. The original default path is located in “/var/www/apache2-default”, so we want our new default directory to be “NEW-DIRECTORY-NAME” (for tutorial sake). Also make sure there is a valid index.html file inside the directory to test the new default path.
* Go to “/etc/apache2/sites-available/”, the “default” text file is what you will need to edit.
* So go ahead and make your backup of the default text file in. (e.g. default.bak)
* Now edit the directory path, which is about 17 lines down from the top.
This is what you should see for the path list information:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RedirectMatch ^/$ /NEW-DIRECTORY-NAME/
</Directory>
* All you need to do now is STOP and then RE-START the Apache2 web service.
To do this open up your console and login as root (or you can ’su’ to root).
* Change your directory to “/etc/init.d/”
-Now STOP the apache service by using the command: apache2 -k stop
-Now START the apache service by using the command: apache2 -k start
* Your default web content directory should now be “NEW-DIRECTORY-NAME” (or what ever you want to called it).




4 users commented in " How to change the default webpage path for Apache2 in Ubuntu "
Follow-up comment rss or Leave a TrackbackThis helped a lot! It should be noted that just hashing out the RedirectMatch line will make it default to /var/www.
that is a good point. If you don?t want to redirect, then just delete the redirect line.
Thanks, it was informative!
that was really helpfull
Leave A Reply