Use .htaccess on subfolders with Drupal


My objective is to protect XCache Admin directory under drupal website. The build-in authentication by XCache doesn't work correctly with mod_fcgi setup. I have no idea why. (It works perfectly with mod_php) So, I just tried to use .htaccess and .htpassword to protect that XCache Admin directory instead.

However, I always got an error by using that .htaccess method until I found an article saying about to password protect subdirectory of drupal website. The only thing I have to add is ErrorDocument 401 "Unauthorized" to the top of .htaccess file.

So, the .htaccess file will contain lines as below :

ErrorDocument 401 "Unauthorized"
AuthUserFile /
AuthName "Authentication Required"
AuthType Basic
require valid-user