WHM/cpanel: HTTP basic auth not working

From lxadm | Linux administration tips, tutorials, HOWTOs and articles
Jump to: navigation, search

If HTTP basic auth doesn't seem to work for a website in WHM/cpanel, or if you see a password popup, but merely pressing "cancel" still displays website content, you may be missing a directive in your .htaccess file which is normally not needed in distributions like Ubuntu, Debian or CentOS.

This directive is "ErrorDocument 401".


  • Here is a config entry which will correctly password protect the website in WHM/cpanel:
AuthType Basic
AuthUserFile /home/account/example.com/.htpasswd
AuthName "Password protected"
Require valid-user
ErrorDocument 401 "Authorisation Required"


  • This one may be not enough in some WHM/cpanel installations:
AuthType Basic
AuthUserFile /home/account/example.com/.htpasswd
AuthName "Password protected"
Require valid-user