So in setting up this new Ubuntu box, I ran into a problem that I couldn’t solve for the longest time, even though it is the simplest of problems–how do you setup DirectoryIndex in Apache2.2 without using a .htaccess file?

It turns out that this is VERY simple. Assuming that you are like me and just setting up Apache 2.2 on a home machine and that you are not using virtual hosting, it goes something like this.

First you want to find your default configuration. For me it was in the /etc/apache2 directory. Using your favorite text editor (mine is joe), open the file:

sudo joe /etc/apache2/sites-available/default

locate the following block:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

then add the following line into the above directory block:

DirectoryIndex nameoffile.extension

For me, it looks like:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
DirectoryIndex login.php index.php home.html

It’s that easy!

Reference