This question already has an answer here:
There are a couple of ways to accomplish this:
Create a file called
.htaccessand place it in your webroot if there is not one there already. Add this line to that file:
By placing it in your webroot it will prevent this from occurring in all sub directories thus preventing this from happening in your site. If you do want this behavior is some directories you will need to add this to the directories (or parent directories) you want affected.
Put a blank index.html page or otherwise have some kind of index page in that directory. Apache wants to serve a default page (typically index.html, index.php) and when it cannot find one shows the directory contents.