Forum Moderators: phranque

Message Too Old, No Replies

Everytime a folder is accessed, it asks for password!

         

slygrrl22

1:54 am on Dec 5, 2004 (gmt 0)

10+ Year Member



Hi all,
Ive been having this serious problem: Htaccess seems to be fine, except that everytime a folder is accessed it asks the user for the password! For example, if a page contains images, it needs to load them from the images folder. This is a problem for every single image that loads. Everytime it asks for the password. This can be sometimes more than 5 times, depending on how many images per page.

Please help! I need it to only ask for the password when one initially goes on the site, not every time a page or image loads.

thanks to anyone who can help me...

slygrrl22

2:49 am on Dec 5, 2004 (gmt 0)

10+ Year Member



Actually, it now seems that its not just images in a folder, but images even within the public_html folder! This makes the problem even worse than I thought.

I wanted to edit the earlier post, but I didnt seem to have the option.

jdMorgan

4:16 am on Dec 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



slygrrl22,

Make sure you are using only one AuthName in the .htaccess files for all parts of the site that you want to use a common "login".

The resources cited in the second message of this recent thread [webmasterworld.com] may come in handy.

Jim

slygrrl22

6:14 am on Dec 5, 2004 (gmt 0)

10+ Year Member



yes I am only using one AuthName
here's the code im using:

AuthType Basic
AuthName "FIT Presidential Scholars Members Only"
AuthUserFile /home/fit/public_html/passwordprotect/.htpasswd
require valid-user
Options +Includes
AddType text/html .html
AddHandler server-parsed .html

I have 1 htaccess file in the public_html folder. That is the only htaccess file. There is only one username & password for everyone to use. Is this an incorrect way of doing it? Everything is fine except that it asks for the password everytime an image loads.

I checked your link, and im not sure how it applies to my situation.

jdMorgan

5:38 pm on Dec 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Message #2 in the thread I cited contains a half-dozen links direct to pages about setting up password protection in Apache. I think they're somewhat relevant. Since authentication and authorization requirements vary widely from site to site, there is no "standard solution" and thus no easy way to tell what might cause a specific problem like yours.

All I can offer is a band-aid solution, which may or may not help:

Replace your "require valid-user" line with all of the following lines. Replace the broken pipe "¦" characters in the third line with solid pipe characters before trying to use this code -- posting solid pipes on this board is not possible, but they are required in the code.


<FilesMatch "\.(gif¦jpe?g¦png)$">
Satisfy any
Allow from all
</FilesMatch>
Require valid-user

This code will by-pass authentication requirements for filetypes of .gif, .jpg, .jpeg, and .png. You may add or remove filetypes from the list, separating entries with the solid pipe character.

Jim

<added> Edited: Code tweak after testing </added>

slygrrl22

4:25 am on Dec 6, 2004 (gmt 0)

10+ Year Member



ok thanks i'll give it a shot. sorry im very new to this stuff, and the reading seems very complicated to me. That's why I wasnt sure what exactly what applied & what didnt. Anyway, I'll try it out & read up a bit more on that link. Thanks for helping and I'll let you know how it turns out!