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
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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!