cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution
Highlighted

Password Protected Directory Won't Prompt for Password - 404 Instead

My password protected directory nacsw.org/member/Publications does not prompt for a password when linking to the files within it. An example link: http://www.nacsw.org/member/Publications/49997135.pdf

returns a 404 error.

 

Recently migrated to cPanel. 

Updated .htaccess code syntax to 2.4 syntax.

Used cPanel Password Protect process to create .htaccess and passwd file and locations.

Wordpress is running on the site. nacsw.org is pulling from nacsw.org/sandbox to service the WP.

 

Any insight would be appreciated.

4 REPLIES 4
Employee
Employee

Re: Password Protected Directory Won't Prompt for Password - 404 Instead

Hello @eduanimator!

 

Thank you for posting. I'm sorry you're having trouble. I'm not certain what would cause this. Have you tried reaching out to our support team on this yet? 

 

Heather - GoDaddy | Community Moderator
24/7 support available at x.co/247support

Re: Password Protected Directory Won't Prompt for Password - 404 Instead

Thanks for responding, Heather.

I did reach out to support. They responded that they had no input, couldn't help since the problem may be related to my code in the .htaccess file. 

 

-Michael

 

 

Solution

Re: Password Protected Directory Won't Prompt for Password - 404 Instead

Solution:

I have WordPress set up to pull from a sub-directory. 

Instead of nacsw.org/, it pulls from nacsw.org/sandbox

The index.php file re-routes the file locations so that my secure folder nacsw.org/memOnly

is being searched for at nacsw.org/sandbox/memOnly

Hence, the 404 error. 

 

I called GoDaddy again. This time, the tech actually wanted to help, unlike the one I talked to before. This helpful one disabled the index.php, and tried again. The password protection worked. He recommended that I move the protected file to the /sandbox folder.

 

Additional Step Needed is explained here: https://forums.cpanel.net/threads/issue-with-htaccess-files-and-wordpress.590907/ due to a conflict between cPanel .htaccess (on Apache) and Wordpress 404 handling.

  • Add a line to the .htaccess: 
    • ErrorDocument 401 /401.html
  • Create a file in your corresponding to the location you listed above: 401.html
    • The file can have any text:  
      PASSWORD PROTECTED FOLDER - Please enter the correct username/password.

Finally, it works!

-mw

New

Re: Password Protected Directory Won't Prompt for Password - 404 Instead

Glad that you were able to identify (WordPress default behavior) and solve the problem. I have the same problem (404 error when trying to access a protected directory).  I see that you now have the log-in to private space working; when there is an access error, the appropriate message comes up (however, the user isn't automatically taken back to the log-in box). Question: Is your site on a shared hosting site? Before I try to correct my problem by dealing with .htaccess in the root of my shared hosting space, I am curious to know if the root .htaccess will then give the log-in error every time there is a 404 error on a shared hosting site. In other words, is your solution working because your hosting space is dedicated to your site or is it working regardless of having a dedicated space or a shared hosting space?