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

My password protected directory does not prompt for a password when linking to the files within it. An example link:

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. is pulling from to service the WP.


Any insight would be appreciated.


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

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. 






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

Instead of, it pulls from

The index.php file re-routes the file locations so that my secure folder

is being searched for at

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: 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!


View solution in original post

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?