how to prevent directory browsing?

Discussion in 'Knowledge Base' started by cca, May 25, 2006.

  1. cca

    cca Perch

    On a windows account i am running some php scripts, therefore i have set Directoy Indexes to ON & added default.asp & index.php to the indexes list for the domain.
    Now if i browse to a folder that has an index.php or default.asp file
    eg www. mysite.com/
    the default or index file will load.
    eg mysite.com/index.php

    My prob is that if i browse to say www. mysite.com/img/
    which has no default.asp or index.php then the page loads displaying the list of files that are in the img folder.

    I donot want the list of files displayed, as i have not set an index for that folder shouldn't it display "Directory Denied" ??

    How can i fix this? do i have to set an index page for every possible folder to prevent folder browsing?
  2. gsaunders

    gsaunders Perch

    I don't know if this is it or not but in your control panel click on domains, then click on the domain in question, then click the edit web services icon, then examine the Settings / Indexes where you have a choice of at least Enabled and Disabled and possibly Fancy. Try setting it to disabled. I am using a linux account so I am not sure if this is the spot.

    Something you can quickly check though. Sorry if this is not it. Just trying to go from memory.
  3. Stephen

    Stephen US Operations Staff Member

    That is correct, and if you need further help feel free to contact us on support.
  4. liming

    liming Perch

    Sorry to bump up an old topic, but can someone confirm this is working correctly for Linux servers?

    I've setup a wordpress install and I'm trying to prevent ppl from browsing the plugins directory. So I disabled Directory Indexes and pressed the "Apply" link.

    However, directory indexes are still browse-able.

    Anyone else encounter this?

    ETA: Fixed it! It had something to do w/ my htaccess. Wordpress was creating something else that seemed to override the settings.

    Basically just put a

    Code:
    Options All -Indexes
    in your htaccess file.

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services