Forum Moderators: phranque

Message Too Old, No Replies

Index manager for directory where is htaccess. but

         

webstyler

1:23 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



Hello

I have a dir /mydir

I need to put inside mydir .htaccess where I tell that user CANNOT view list file on /mydir but CAN view list file of dir inside this.. as /mysir/one/ /mydir/two/ ..

How make this withou put others .htaccess inside dir /one /two ..?

Tx

jdMorgan

12:39 am on Feb 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use mod_rewrite with the [F] flag and a pattern that excludes subdirectories.

Jim

webstyler

8:17 am on Feb 7, 2008 (gmt 0)

10+ Year Member



but with mod_rewrite I can use indexes?

jdMorgan

3:40 pm on Feb 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you set Options +Indexes to allow display of server-generated directory indexes, and then use mod_rewrite to disallow serving the index of the top-level directory only. The mod_rewrite rule needs a RewriteCond that looks to see if the request is for a subdirectory. If so, the rule is bypassed. If the request if for the top-level directory, then the rule is applied forbidding access to the index.

An alternative is to simply put a default index page into the top-level directory; The server will only generate a directory index listing if there is no "home page" in the directory.

Jim