I have a wordpress install in the root directory but also have a directory called 'admin' which contains a PHP membership system. I couldn't initially access this directory as I kept getting a 404 on the Wordpress site but added:

ErrorDocument 401 default

in to the .htaccess file and the 'admin' folder then became accessable. The admin folder now needs to be password protected so I have given it a htaccess file of its own containing:

AuthType Basic  
AuthName "restricted area"  
AuthUserFile xx.xxx.xxx.xx/public_html/admin/.htpasswd  
require valid-user

but this now makes the 'admin' folder inaccessable again, is there something I need to put in either of the htaccess files to make this work or is there a different method of password protecting the admin folder without using htaccess?


  • not a duplication as not the same problem, i've explained in my question that ive overcome that initial problem of not being able to access subdirectories.
    – Adrian
    Sep 25, 2015 at 9:57
  • 1
    IMO this is off-topic as it is not specific to wordpress and you would most likely have the same problem with drupal or jomla. The right place to ask is stackoverflow or webmaster, not which is better.. Sep 25, 2015 at 10:08
  • Sorry, you are right. It is not the same problem of the question I linked.
    – cybmeta
    Sep 25, 2015 at 10:08

1 Answer 1


I have found a response on a forum which suggests that the only way of acheiving this is to create a subdomain for the folder which is to be protected, this works fine.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.