############# MAINHOST.COM ################
ServerAdmin admin@mainhost.com
DocumentRoot "/usr/local/apache2/htdocs"
ServerName mainhost.com
ServerAlias www.mainhost.com
#Options Indexes FollowSymLinks
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{HTTPS} !on [OR,NC]
RewriteCond %{REQUEST_SCHEME} !https [OR,NC]
RewriteCond %{SERVER_PORT} !443 [NC]
RewriteCond %{HTTP_HOST} ^mainhost\.com$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [R=301,L]
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
ErrorLog "logs/error_log"
CustomLog "logs/access_log" common
############# EXAMPLE.COM ################
ServerAdmin admin@example.com
DocumentRoot "/usr/local/apache2/htdocs/example.com"
ServerName example.com
ServerAlias www.example.com
#Options Indexes FollowSymLinks
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{HTTPS} !on [OR,NC]
RewriteCond %{REQUEST_SCHEME} !https [OR,NC]
RewriteCond %{SERVER_PORT} !443 [NC]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [R=301,L]
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
ErrorLog "logs/error_log"
CustomLog "logs/access_log" common