<VirtualHost *:80>
	ServerName www.njoubert.com
	ServerAlias njoubert.com
	DocumentRoot /var/vhosts/njoubert.com/www/
	
	# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
	LogLevel warn
	ErrorLog /var/log/apache2/error.log
	CustomLog /var/log/apache2/access.log combined
	ServerSignature On 

	#VIRTUAL HOSTS
	RewriteEngine On
	RewriteMap sub prg:/usr/local/etc/apache2/sub.pl
	RewriteCond %{HTTP_HOST} ^(?:(.*?)\.)?([0-9a-z_-]+\.[a-z]+)$ [NC]
	RewriteRule ^/(.*)$ /var/vhosts/%2/${sub:%1|www}/$1 [L]

	<Directory />
		Options FollowSymLinks
		AllowOverride all
	</Directory>
	<Directory /var/vhosts/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride all
		Require all granted
	</Directory>
</VirtualHost>
### 2020.12.26 Adding SSL
<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerName www.njoubert.com
	ServerAlias njoubert.com
	DocumentRoot /var/vhosts/njoubert.com/www/
	
	# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
	LogLevel warn
	ErrorLog /var/log/apache2/error.log
	CustomLog /var/log/apache2/access.log combined
	ServerSignature On 

	#VIRTUAL HOSTS
	RewriteEngine On
	RewriteMap sub prg:/usr/local/etc/apache2/sub.pl
	RewriteCond %{HTTP_HOST} ^(?:(.*?)\.)?([0-9a-z_-]+\.[a-z]+)$ [NC]
	RewriteRule ^/(.*)$ /var/vhosts/%2/${sub:%1|www}/$1 [L]

	### 2020.12.26 enabling SSL
        SSLEngine on

        SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
        SSLCertificateKeyFile   /etc/ssl/private/apache-selfsigned.key
        
        BrowserMatch "MSIE [2-6]" \
                               nokeepalive ssl-unclean-shutdown \
                               downgrade-1.0 force-response-1.0

	<Directory />
		Options FollowSymLinks
		AllowOverride all
	</Directory>
	<Directory /var/vhosts/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride all
		Require all granted
	</Directory>
</VirtualHost>
</IfModule>
