Avoiding Multiple Dialog Calls with htaccess
- by Jeffrey J Weimer
OK, I'm new to this, so pardon if the question is already a FAQ. Searching multiple places still leaves me dumbfounded.
I have a Web site generated with iWeb09/Mac hosting on an ISP. To secure certain pages, I am trying to set up .htaccess + .htpasswd files. The basic directory structure is ...
Main
index.html
Images.html
Images
(some css, js stuff)
Media
Image01
Image01.jpeg
...
Image02
Image02.jpeg
...
I want to password protect access to the Images directory and all the files therein. The index.html file has a link to the Images.html file that contains the layout for the files in the Images directory.
I have put a basic .htaccess file at the Main level that restricts access via ...
<Files "Images.html">
AuthType Basic
AuthName "Images"
AuthUserFile /Main/.htpasswd
AuthGroupFile /dev/null
Require valid-user
</Files>
I have then created a valid .htpasswd file.
All works at the start, however after the first call to set up the Images.html page, the secure login prompt is displayed multiple times, presumably once for every sub-sub-directory Images/Media/ImageXX (with multiple sub-directories, I just give up after two or three times). I have also tried placing the .htaccess file inside the Images directory with the same problem.
Recommendations I have seen suggest a better convention is needed in the basic .htaccess file itself. Alternatively, perhaps a companion .htaccess is needed in the Images directory.
So, how do I fix this problem?
--
JJW