8 thoughts on “Denying Directory Listing With htaccess

  1. Root

    Where did my comment go ? Am i err delisted? What’s up? It is as bad as the WP forum ?:) LOL.

    PS: You need to be a Japanese caligraphist to understand your captcha graphics. :)

  2. Juan Wong Post author

    No, you weren’t marked as spam, I just didn’t turn my computer on yesterday but until today and found your comments in the queue. Sorry for posting them late.

    :D

  3. WebTenet Solutions

    I have two questions:

    1. On a shared hosting if the host does not give you Override all, should this “Options -Indexes” work on my .htaccess file?

    2. What should I do if I want to deny directory listng on an entire website but allow just one directory?

    Thanks in advance :)

  4. Juan Wong Post author

    WebTenet,

    1) I think you’re talking about the AllowOverride directive, correct? If the hosting provider has set it to None, then your .htaccess file will completely be ignored.

    2) In the directory, where you want to allow directory listing, you should place an .htaccess file with the following: Options +Indexes

    HTH

  5. Juan Wong Post author

    Digatex,

    If I understood your question well, then the answer is that the root (or any other) directory listing shouldn’t be allowed. Obviously, if the root (or any other) directory lacks of an “index” file, the person trying to access such directory would see a 403 message:

    Forbidden

    You don’t have permission to access /[directory_name]/ on this server.

    HTH

Comments are closed.