How to disable directory indexing for all directories using root htaccess?

Using this line Options -Indexes only disable listing on directory where the htaccess put.

I'm sure there's a lot of directories that need the listing disabled and it's better if i can use single root htaccess to do that.

  • 1
    The parent .htaccess file on the filesystem is always inherited by subdirectories.
    – MrWhite
    Aug 13 '15 at 13:48

Turns out Options -Indexes on root htaccess will disable indexing for its sub folder. Case closed.


If you use cPanel, you can change the setting through there:

  1. Select Advanced > Indexes (might be called Index Manager depending on your version of cPanel)
  2. Click public_html (or whatever your web root is)
  3. Select No Indexing
  4. Click Save

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.