I have a previous post which demonstrates how to add HTTP Authentication by .htaccess.
.htaccess – Setting Password For Your Web Folder
But if it does not work and shown the following error in the Apache error log
- /home/ykyuen/public_html/.htaccess: Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration
You can fix it by turn on the authn_file module. For Debian Linux like Ubuntu,
- a2enmod authn_file
- /etc/init.d/apache2 restart
For Fedora, add the following line to /etc/httpd/conf/httpd.conf
- LoadModule authn_file_module modules/mod_authn_file.so
Then restart the Apache
- /etc/init.d/httpd restart
Done =)
Filed under: Apache Tagged: .htaccess, Apache, authn_file, AuthUserFile, Debian, Fedora, httpd.conf, Linux, Postaday2011, Ubuntu
