How to Fix - Apache Error: No Matching DirectoryIndex?

You may face the error given below while accessing applications that have index files other than index.html/index.php or other specified directory indexes – 

Apache Error: No matching DirectoryIndex?

By default, Apache is configured with the following directory index – 

<IfModule dir_module>
DirectoryIndex index.html

It means that Apache will only look for directory index files that are named index.html. So, whenever we attempt to access phpMyAdmin, Apache shows an error.

To resolve this issue, we will need to add the index.php file as a DirectoryIndex.

1. Run this command – 

vim /etc/httpd/conf/httpd.conf

2. The above command will open the configure file, and we will need to add the below line in the configuration file.


<IfModule dir_module>
DirectoryIndex index.html


<IfModule dir_module>
DirectoryIndex index.html index.php

3. Once you add “index.php” in the configuration file, exit from the editor and save the file. 

4. Please note that we have changed configuration files, so we need to restart the Apache service. For that, follow the command given below – 

systemctl restart httpd

Your error should be gone now! 


Was this answer helpful?

« Back