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.
Solved! Go to Solution.
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 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.
ErrorDocument 401 /401.html
PASSWORD PROTECTED FOLDER - Please enter the correct username/password.
Finally, it works!
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?