There are 2 ways to enable apache file and directory indexing.
Using Apache config file :
- You can add directory options in the Apache configuration file directly. httpd.conf is a apache config file or you can add it in /etc/apache2/apache2.conf:
# vi /etc/apache2/apache2.conf
<Directory /var/www/example.com/folder>
Options Indexes FollowSymLinks
</Directory>
- Once you add the above code, save and close the file.
- Restart httpd service.
# /etc/init.d/httpd restart
Using .htaccess Files with Apache :
If you have .htaccess enabled, you can put a config line options indexes in your .htaccess file.
- Open your .htaccess file.
# vi .htaccess
- Add the following apache directive.
Options Indexes
DirectoryIndex index.php index.html /example.php - Save and close your .htaccess file.