Question
How can I use .htaccess but avoid a second password prompt when first accessing a sub-directory?
The website is hosted on GoDaddy, and I have a directory protected with .htaccess and .htpasswd. The .htaccess file is located in the protected parent directory, and the .htpasswd file is located in a separate directory. When I navigate to the protected, parent directory, I’m prompted for user ID and password as expected. I enter the ID and password and gain access to the “home” page. If I then select a link on the home page to a different page in a sub-directory of the parent directory, I’m prompted a second time for user ID and password. After entering ID/password a second time, I’m not prompted again for access to any additional pages located in the parent or its sub-directories.
Another curious behavior for these pages is that for some visitors to the site, ALL URLs must use the ‘www’ prefix. For other visitors, the 'www’ prefix is not required for <a…> tags within the pages. I mention this because it may be related.
What am I overlooking in .htaccess that if added would result in “normal” behavior i.e. entering user ID and password for access to the parent directory would allow accessing any sub-directory of the parent without entering ID/password a second time?
Here’s the .htaccess file
comment: Private Application
path: /home/content/private/html/57X/
AuthName “57X”
AuthType Basic
AuthUserFile /home/content/r/l/a/rlandman/html/pw/.htpasswd
require valid-user
Thanks for any help you might offer.
irwin4
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×