I\'ve got several sites: example.com, example1.com, and example2.com. All of them point to my server\'s /public_html fo
Here is one recommendation:
Create a file called common.conf and save in an accessible location
In this file place the Apache configuration common to all sites (hosts).
The remove the current single VirtualHost entry an replace with VirtualHost entries as follows:
# These are the password protected hosts
ServerName example.com
ServerAlias example1.com
Include /path-to-common-configuration/common.conf
AuthType Basic
AuthName "Password Required"
AuthUserFile "/path/to/.htpasswd"
Require valid-user
# These are hosts not requiring authentication
ServerName example2.com
ServerAlias example3.com
Include /path-to-common-configuration/common.conf