How to allow downloading files with PHP, but deny direct access to directory listings
问题 I am using Apache on my server and I'd like to allow my visitors to download resources free of charge. However, to preserve even a little bit of bandwidth I'd like to deny direct access to the root folder of the resources like this: www.myhost.com/resources/file.wav If the visitor removes file.wav from the URL, they have access to all sounds at once and thus I'd have people just downloading like crazy. I don't want that. How can I stop the users from going into that root directory, and any