Stardust

Password Protected Directory Returning 404 Error

Password protected directory returning 404 error. This can be a protection set via cPanel or manually. This is because the site CMS (WordPress for instance) is handling by default the 401 and 403 errors. We just need to prevent the CMS to handle these errors by modifying the .htaccess (there is another .htaccess generated in the protected directory, but this will remain untouched). If the protected directory’s .htaccess is not created, we can create one with the following content:

AuthType Basic
AuthName "Protected"
AuthUserFile "/home/cueinc/.htpasswds/folder_to_protect/passwd"
require valid-user

After making sure all the permissions and the file’s and directories username and group are correct, we need to modify the main .htaccess by adding this at the start of the file:

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html

If that doesn’t work, you can try using:

ErrorDocument 401 default
ErrorDocument 403 default

That’s all folks, see you  later!

Leave a Reply

Your email address will not be published. Required fields are marked *