If you have no index or default page in a public_html or specific directory, a visitor may be shown with a full list of files that the directory contains. This is usually not a good idea as it could pose a security risk. To avoid this, just add this line to the htaccess file.
Another way to turn off an index listing is :
This statement says the directory should not list “all” or any files that it has. The star symbolizes all files.
If you want directory listing to turn on but the main server settings have it turned off, you may turn it on like this :
To turn on the directory listing BUT have to hide some files particularly some image files showing :
IndexIgnore *.gif *.jpg
Using this, any files that do not have a GIF or JPG extension on them would be allowed to be listed.