I have an htaccess file in my root directory to add rules such as force www on website, etc.
I want to protect a directory on my site such as example.com/private/ and example.com/private/p/
I here is where my htaccess files are:
/public_html/.htaccess (htaccess file to force www. on my site)
/public_html/private/.htaccess (protect directory code)
/public_html/private/.htpasswd (usernames and passwords for directory)
I keep getting a 401 Unauthorized when i try to click on a link to a /private/ URL and don't even get the password prompt sometimes. I have tried clearing my cache, but it still does not work.
Here is my /private/.htaccess code (protect directory code) (I know my AuthUserFile path is right by the way):
AuthType Basic
AuthName "Members Only"
AuthUserFile /public_html/private/.htpasswd
<limit GET PUT POST>
require valid-user
</limit>
When I remove the /public_html/.htaccess file, the login works fine. Anyone know why and how to fix this so I can use both .htaccess files?