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