Forum Moderators: phranque

Message Too Old, No Replies

Directory not visible when using .htaccess with "Require" directive

         

paulsb

10:13 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



Hello! This will be my first post/question on this wonderful website/forum :)

Now the story:
I have set up virtual host in apache, something like download.mydomain.com. The directory is overriden with .htaccess file - the only line is:

Options Indexes

It's all good- I can see directory listing. Now i wanted to passwordprotect subdirectory- download.mydomain.com/protecteddir/ so i added another .htaccess file in this subfolder, containg following lines:

AuthType Basic
AuthName protected
AuthUserFile /path/to/.htpasswd
Require valid-user

Now here's the problem- this protected folder now is not showing up any more on the list in the root directory tree (when i navigate back to download.mydomain.com, it seems /protecteddir/ is just hidden). How can i solve this? If I type manually in the location bar full path of protected dir, i can successfully log in/access it. But I really want to see this folder in root tree. Is this possible?

Linux,
Apache 2.2.0 (and same also on 2.0.55).
--
tnx, Paul.

jdMorgan

10:30 pm on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paul,

Welcome to WebmasterWorld!

Try moving the Options +Indexes directive to the DocumentRoot, so that it is not dependent upon access to the protected directory. Note also the syntax, +Indexes. If you use just Indexes, then it disables all other Options.

Jim

paulsb

11:07 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



Jim, thank you for your quick response.

What do you mean by DocumentRoot? To add +Indexes to the whole server in httpd.conf? That would not be a good idea i think. Note that I tried that also :), but I don't think it has to solve my problem.

Instead I configured apache to AllowOverride All for my /server/download.mydomain.com directory AND there put .htaccess file with Options Indexes directive. (also tried +Indexes).

With this I can see directory listing for every (sub)folder on my download.mydomain.com, but when I make another .htaccess file in one of the subfolders with "Require valid-user" directive then boom- protected directory is not showing up any more. :/ I still can access this folder and see it's directory listing after authorization, but it's gone from the root list.. confused..

jdMorgan

1:00 am on Dec 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Document_root is the "home page" directory where your "index.html" site home page and robots.txt would be located.

I haven't experimented with this idea, so I'm sorry, but I'm stumped... I hope someone else here may have some better advice. (bump)

Jim