When you have installed WordPress under your main domain and you wish to set any Directory as password protected which is present under your domain’s public_html Directory but after setting the directory as a password protected
You are getting 404 error or not found error while browsing/accessing the URL.

Just do the below simple step 🙂

1) Open the .htaccess files in which your password protect code is inserted and the below line.

ErrorDocument 401 default

save it and you have done it 🙂