I previously configured Apache server on Linux to use a password to protect some pages. However, when I tried it on a Mac server, I had a lot of trouble when trying to get it to work. I double-checked the .htaccess file and made sure the syntax was right. I later discovered that the problem was not with the .htaccess file I had. The problem was that the password protection option is turned off by default on Mac. The Apache configuration file is in this directory: /etc/apache2 . I opened up an editor to edit the configuration file httpd.conf and change this line from
and restarted the Apache web server. It did not work. It took me a while to find the second configuration file that I needed to change. The second configuration files is this one: /etc/apache2/sites/0000_any_80_.conf. After I edited this file to change the AllowOverride option and restarted the web server, the password protection began to work. By the way, if you are concerned about your web site’s security, you can change the settings to
AllowOverride AuthConfig, which provides more restricted features and makes your site safer.