Prevent File Browsing with .htaccess
Need to block access to a directory on your site?
If your hosting environment runs the Apache web server, you can simply create an .htaccess file in the directory you’d like to protect and insert the following code:
Options -Indexes
For example, say you’ve created a sub-folder on your site to hold images. Without protection, a user could visit http://yoursite.com/images/ and see a directory listing of the files and folders in the images directory.
By simply creating a file with the above line and saving it as .htaccess in the images directory, users will get an error rather than a directory listing when they visit the URL.
For more info on .htaccess, visit the Apache website.