Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DirectoryIndex doesn't work

I use apache2 to host a site. There are both index.html and index.php in my directory.

I open the /etc/apache2/apache2.conf and add a line:

DirectoryIndex index.php index.html index.htm

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

I look around but can't find problem. My httpd.conf is empty and I don't have .htaccess file.

Where may the setting hide?

Edit: After I modified /etc/apache2/mods-availiable/dir.conf, it finds the index.php.

But WHY the apache2.conf can't overwrite dir.conf?!

like image 247
Lai Yu-Hsuan Avatar asked Jun 28 '11 16:06

Lai Yu-Hsuan


1 Answers

I think mod_dir isn't loaded, try to command sudo a2enmod dir and service apache2 restart

like image 121
shadowman Avatar answered Nov 15 '22 10:11

shadowman