Password protection leads to 404 errors



Hi there,
Thank you for your help.

I am trying to password protect a directory on my website. I have tried using the tools at: Goodies > Htaccess/WebDAV in my web panel following the instructions I found here: and I have also tried to uploading a .htaccess and .htpasswd files I created myself. Neither of these has worked.
When the .htaccess and .htpasswd are created and I try to access the directory I get a 404 error.
Does anyone have any ideas what could be going wrong here?
I do have WordPress installed on my site but it is not in the same folder that I am trying to protect.
Any suggestions would be appreciated.
Thank you.


It sounds as though the re-write rules WordPress has installed in .htaccess might be the source of your problem. This causes the url to be re-written in such a way that your “other” non-WordPress directories are not properly located.

If so, this is similar to the problem with accessing the Dreamhost provided /stats/ directory with WordPress installed, and you can find some guidance on how to correct that here

While not exactly the same, the information in the provided wiki link should help you determine how to apply the changes on your site to reflect your directory structure.

Good Luck, and let us know what you find out.


Thank you rlparker. I followed the instructions on the page you directed me to and it worked. Thank you.

I have one other password issue and any help will be appreciated.
Here is the directory structure

directoryA contains all the admin files and needs to be password protected. I have successfully done this thanks to the advice I received…

directoryB contains the files that need to be accessible by the public.

I created a new .htaccess file for directoryB and put this in it:

order allow
allow from all

However when I try to access the folder I get a 404 error.

Would anybody have an idea on how to allow access to directoryB while restrict access to directoryA?

Thank you again.


You are most welcome, I’m glad you got that sorted! As for your next question, I don’t know of a convenient way to deal with that situation off the top of my head. Maybe one of the .htaccess gurus here can shed more light on the issue, but I’m stumped by the fact that .htaccess affects the directory it is in and all directories beneath that directory in the directory tree. That would appear to prevent you from “loosening” access restriction for “DirectoryB”, if it is contained within “directoryA”, which you have secured.

I believe, that the 404 error is a result of the same WordPress issue previously discussed (and that you resolved for directory), and believe you need to make the same type of adjustment for “directoryB” as you did for “directoryA”. Doing so should eliminate the 404 problem for directoryB, but you would still need to deal with the password protection issue once the page is “found”.