I’d like to do something like this:
I have a directory which I want to be password protected, recursively. The user who want to access this directory and its sub-directories and the files inside them will be prompted to enter user/pass; once they are authenticated, they are free to view all the files in it (recursively).
I am currently using .htaccess to do this and what i found out is that .htaccess recursively affect directories below it (which is what I want) but at the meantime, requesting a file in another sub-directory (say, /protected_dir/anotherdir/index.html) yields the same authentication request even though the user has just passed the one in the entry dir (say, the one from /protected_dir/index.html, which is NOT what I want). So the user has to do this the second time if she chooses to view some files in a sub-directory.
Is there a way to just have the user authenticated only the first time she requests a page (either the index.html or a file in a subdir) while still having all the sub-directories protected? Can this be done with just .htaccess or do I need to use some scripting to do that?