How To Resolve 404 Error When Password Protecting WP-Admin Directory

Well if you’ve come to this blog post you’ve probably tried to password protect your wp-admin directory in Wordpress and received a 404 error.

The likely reason you are having this issue is because of the rewrite engine Wordpress uses to make search friendly URL’s puts a .htaccess file in the roof folder of the Wordpress installation, and the code in the .htaccess file causes Wordpress to take any unknown URL and serve the appropriate page or error. Your file should have code similar to this:

In my case the password protected page wants to tell me about the 401 situation I am in (authentication) but my server has a default location for this, and there is no file there. So Wordpress passes us a 404 error.

The solution is to download .htaccess file where Wordpress is installed via FTP, open it using notepad or similar and add the following code before the Wordpress entries, or modify the current ErrorDocument 401 line to the following:

ErrorDocument 401 default

Save the file, then re-upload it via FTP. Now, when you try accessing the protected folder you should get a pop-up box asking you to enter your user name and password.

Note: After I fixed my wp-admin password protection issue, I was no longer able to use the flash file uploader within Wordpress. I now have to use it in browser uploader mode, by doing so it works just fine.


Be the First One to Know when there are more great posts like this one!


Leave a Reply