How to Resolve the Apache Error: No matching DirectoryIndex?
Take note
Because this lesson requires root access, it can only be completed on VPS, Dedicated, and Cloud servers.
When trying to visit apps that contain an index.php file (or another index file), but not an index.html file or another designated “directory index” file, you may see this error.
For instance, after installation, phpMyAdmin only has an index.php file and not an index.html file.
By default, Apache is set up using the following command:
DirectoryIndex index.html
It means that Apache will only check for the directory files that are named index.html.
While trying to access phpMyAdmin, Apache gives the below error:
[autoindex:error] [pid 20115] [client 10.30.6.80:50800] AH01276: Cannot serve directory /usr/share/phpMyAdmin/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
In this case, add index.php to the DirectoryIndex directive.
vim /etc/httpd/conf/httpd.conf
Change the below line:
DirectoryIndex index.html
to:
DirectoryIndex index.html index.php
Now exit and save the file using the command :wq .
Ensure to restart Apache:
systemctl restart httpd
Congratulations! You have now learned to solve the Apache Error: No matching DirectoryIndex.
How can I build a WordPress website using the server URL of my account?