How to disable directory listing in apache

In Apache HTTPD server normally when you have no index or default page in a directory, a visitor may be served with a full list of files in that directory. To stop default directory listing follow any one of the steps given below

1. Open/Create the .htaccess file and add

Options -Indexes

OR

2.Open the httpd.conf(apache configuration) file and look for the section

<Directory /var/www/html>
…..
Options Indexes FollowSymLinks
…..
</Directory>

change to

<Directory /var/www/html>
…..
Options -Indexes FollowSymLinks
…..
</Directory>

then restart your Apache server. That is it, directory listing will be disabled now.
Note :- here ‘/var/www/html’ is the document root directory.