Use .htaccess on subfolders with Drupal

By BXTra |
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 /path.to/.htpasswd
AuthName "Authentication Required"
AuthType Basic
require valid-user

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.