Skip to main content

Directory Privacy not working for a Sub-directory

Comments

5 comments

  • cPRex Jurassic Moderator
    Welcome to the Forum! When I tested the "Directory Privacy" option on my personal system, I see the following is added to the .htaccess in /home/username/subdomain once I enabled directory privacy: #----------------------------------------------------------------cp:ppd # Section managed by cPanel: Password Protected Directories -cp:ppd # - Do not edit this section of the htaccess file! -cp:ppd #----------------------------------------------------------------cp:ppd AuthType Basic AuthName "subdomain test" AuthUserFile "/home/username/.htpasswds/sub.username.com/passwd" Require valid-user #----------------------------------------------------------------cp:ppd # End section managed by cPanel: Password Protected Directories -cp:ppd #----------------------------------------------------------------cp:ppd
    After creating the user and password in the next step, a passwd file is created in /home/username/.htpasswds/sub.domain.dom with the specific username and password for the directory. It's those two files, the .htaccess and the .htpasswd working together that create the security. It seems like you may have only one the first step of enabling the option in cPanel >> Directory Privacy, but you also need to create the user and password to go with it. Directory Privacy | cPanel & WHM Documentation
    0
  • Daddygumball
    I have a user and a password as i followed every single step of this link more than once Directory Privacy | cPanel & WHM Documentation but it still wont work and as you can see in the .htaccess, the pswd file is linked, and I also manually added these two lines AllowOverride All ErrorDocument 401 "Authorisation Required" since I read in two different forms that adding the lines should solve the problem. However, no matter what I do, I still access the page on the website without it asking for credentials. What could be the problem here? I tried testing it on the whole public_html (by making the public_html dir private), and it worked. (When i first called the link on Chrome, it asked for credentials.) but I want the privacy directory to be on only one page of the whole website.
    0
  • cPRex Jurassic Moderator
    I don't have a good explanation for what is happening there, since this is one of those areas that should just work automatically. If you have root access to the whole server, you're welcome to submit a ticket to our team so we can take a look. If you only have access to cPanel, you'll need to reach out to your hosting provider or datacenter to have them help with the issue.
    0
  • quietFinn
    ... when I go to the link to the page I wanted to protect, nothing happens; it doesn't ask for the username and password. is there any way to solve this?

    If possible, test it with another browser.
    0
  • Daddygumball
    If possible, test it with another browser.

    I just did and also tested it with a different laptop, but it still won't ask for credentials.
    0

Please sign in to leave a comment.