Forum Moderators: phranque

Message Too Old, No Replies

Hiding directory listing

directory index shows if no index page found

         

henry0

12:35 pm on Oct 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a dir at root level which contains many sub-dirs and files
(all PHP)
I do not wish to call this dir "main page" as an index.php.
As such if someone enter whatever.com/this_dir/
Since there is no default index the structure within “this_dir” is revealed

How can I impeach that to happen (short of renaming a file index.php)?

jdMorgan

12:58 pm on Oct 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add

Options -Indexes

to .htaccess in that directory, or remove "Indexes" from the Options set in the httpd.conf configuration file.

JIm

henry0

2:36 pm on Oct 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jim

Using a .htaccess generated a "forbidden access"

so indeed noway to expose the structure

out of curiosity is the "forbidden access"
the intended result?

other than that the rest is as intended fine and accessible.

jdMorgan

3:16 pm on Oct 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that directive forbids access to the server-generated default directory listings.

Jim

spinnercee

5:43 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



It also wouldn't be a bad idea to put an index.html (or other named DirectoryIndex file) in the directory that says something really simple to tell visitors and crawlers that your site isn't broken (returning an err page), just that there is no useful content here.

I have also been able to use a rel file/path in the DirectoryIndex directive to make sure that something is always returned:

DirectoryIndex index.html index.htm /someplace/gohome.html

/someplace/gohome.html (which must exist) simply contains a link and possibly a meta refresh tag to the intended start page. Using it will prevent any directory from displaying within the scope of the DirectoryIndex directive.

henry0

9:01 pm on Oct 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



spinnercee, not a bad idea! thanks