How to fix the No-matching DirectoryIndex Apache Error

November 25, 2022 / Web Development

This guide will explain how to fix the “No Matching DirectoryIndex-Apache error”. When trying to visit apps that have an index.php file (or another index file), but not an index.html file or another defined “directory index” file, you can see this problem. Make sure you have root access to fix the issue.


Let us find out which commands are used to fix the error

  1. The following command is used to setup Apache by default-
    DirectoryIndex index.html
  2. This indicates that Apache will only search directories for files with the name index.html. The following error is returned by Apache while attempting to access phpMyAdmin-
    [autoindex:error] [pid 20115] [client] AH01276: Cannot serve directory /usr/share/phpMyAdmin/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

Follow the steps to fix the error

  1. Add “index.php” to the “DirectoryIndex” directive in this scenario.
    vim /etc/httpd/conf/httpd.conf
  2. Modify the below line:
    DirectoryIndex index.html ? DirectoryIndex index.html index.php
  3. Exit now and use the “command:wq” to save the file.
  4. Restart Apache:
    systemctl restart httpd

This way you can fix the No matching DirectoryIndex apache error. Hope you liked our article and grasped everything properly. Still, if you face any issues, you can contact our support staff. They are available for you 24×7. Also, you can regularly visit our WHUK’s KB section.

Dominos Search