Search code examples
apache.htaccess

deny directory listing with htaccess


I have a folder, for example : /public_html/Davood/ and too many sub folder in folder, for example : /public_html/Davood/Test1/ , /public_html/Davood/Test1/Test/ , /public_html/Davood/Test2/ , ...

I want add a htaccess file into /public_html/Davood/ To deny DirectoryListing in /Davood and sub folders. It's possible?


Solution

  • Options -Indexes should work to prevent directory listings.

    If you are using a .htaccess file make sure you have at least the "allowoverride options" setting in your main apache config file.