Listing directory content on a webserver is not a good security practice. But it is noticed that if you are using cpanel for managing your domain, by default directory listing is enabled. You can check this by typing http://www.yourdomain.com/<your dir>/
If it lists the files and folders then this guide is to explain how to disable it.
1. If you don’t have many directories simple way is to create a simple plain index.html file and place it on the directory where you want to block directory listing. Default behavior of a web server is to show any of these file such as index.htm,index.html. index.php, index.asp etc. It would be tedious for you to place these index files on each directories if you have to manage lot of sub folders on your web server.
2. cpanel provides a cool feature to disable directory listing, You can navigate to cpanel –> advance –> index manager , select your root directory , select no indexing . Simple, its done !!
3. Another option is to create a .htaccess file in your root with following content (depending on your requirement)
# This will not show anything
#This will not show gif and png images, but will list everything else
IndexIgnore *.gif *.png
It covers all the ways to disable directory listing on a webserver which includes cpanel configuration.