How to fix - Apache Error: No matching DirectoryIndex?

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

Apache Error: No matching DirectoryIndex?

Please refer to the following in order to fix the issue. 

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 throws an error.

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

  1. Run the command.

    vim /etc/httpd/conf/httpd.conf
  2. Above command will open the configure file and we will need to add below line in the configuration file.


    <IfModule dir_module>
    DirectoryIndex index.html

    <IfModule dir_module>
    DirectoryIndex index.html index.php

    Once you add “index.php” in the configuration file, exit from the editor and save the file. Please note that we have changed configuration files so we will need to restart the Apache service. For that follow below command:

    systemctl restart httpd

    Your error should have gone now. So, this is how you can resolve the DirectoryIndex error.

Related Articles

What are the benefits of CloudLinux?

There are numerous advantages and benefits of CloudLinux OS and we will discuss it in this...

How to use chmod to change file permission?

In this article, we will describe how to use the chmod command to modify file permission in Linux...

How to Setup MySQL Master-Slave Replication on RHEL 7?

In MySQL Replication process, one server data is automatically copied to another backup server in...


Nextcloud is an open-source and secure PHP-based content collaboration platform. It is used for...

How to reset/renew cPanel/WHM Self-signed Certificate?

You might be receiving an email with subject like “The SSL certificate for “[service like exim,...

  • 0 Users Found This Useful

Was this answer helpful?