Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Web Hosting FAQ  >  How to Resolve the Apache Error: No matching DirectoryIndex?
Top Scroll

How to Resolve the Apache Error: No matching DirectoryIndex?

 2 min
Note

For this tutorial, you need to have root access and so, this can be done only on VPS, Dedicated and Cloud.

You might face this error while attempting to access applications that have an index.php file (or other index file), but not an index.html or other specified ‘directory index’ file.

For example, phpMyAdmin comprises of index.php file after installation, but not an index.html file.

Apache is by default configured with the below 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.

Also Read
Steps to Modify Apache Directory Listing Style
Learn to Restart Apache on Dedicated Server

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.