DirectoryIndex not working

I use apache2 to host the site. My directory has index.html and index.php.

I open /etc/apache2/apache2.confand add the line:

DirectoryIndex index.php index.html index.htm

Then restart apache2. But when I open localhost/~username, it accesses index.html.

I look around but cannot find the problem. My httpd.conf is empty and I do not have a .htaccess file.

Where can I hide the setting?

Edit : after I change /etc/apache2/mods-availiable/dir.conf, it finds index.php.

But WHY apache2.conf cannot overwrite dir.conf ?!

+5
source share
2 answers

I think that is mod_dirnot loaded, try the command sudo a2enmod dirandservice apache2 restart

+1
source

.htaccess , , . .htaccess , DirectoryIndex, , , Apache , , :

DirectoryIndex index.php index.html index.htm index.phtml start.html

.htaccess.

0

All Articles