How to Resolve the “No Matching DirectoryIndex Apache Error”

December 21, 2023 / How-to Guide

This tutorial provides systematic instructions on resolving the “No Matching DirectoryIndex Apache error.” This issue often arises when accessing applications with an index.php file (or another index file) but lacking an index.html file or any other specified “directory index” file. Ensure you have root access to address and rectify this problem effectively.

Let us identify the commands utilised to resolve the error:

  1. The below command is used to set Apache by default-
    DirectoryIndex index.html
  2. This implies that Apache exclusively looks for files named index.html within directories. Apache when attempting to access phpMyAdmin generates the subsequent error-
    [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

Now, let us follow the steps to fix the error:

  1. Include “index.php” in the “DirectoryIndex” directive for this situation.
    vim /etc/httpd/conf/httpd.conf
  2. Change the below line-
    DirectoryIndex index.html ? DirectoryIndex index.html index.php
  3. Exit and save the file by using the command “:wq”.
  4. Restart Apache using-
    systemctl restart httpd

You can resolve the “No Matching DirectoryIndex Apache error” by following these steps. We trust you found our article helpful and understandable. If you encounter any challenges, feel free to reach out to our support team, available around the clock.

Spread the love