<Virtualhost *:80> 
  ServerName %%fqdn%%
  AssignUserId #%%UID%% #%%GID%% 
  SetEnv LOGIN "%%UID%%-%%LOGIN%%"

  KeepAlive Off 

  RewriteEngine On 
  RewriteCond %{REQUEST_FILENAME} !/cgi-bin/
  RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] 

</Virtualhost>
<VirtualHost *:443>
  DocumentRoot /usr/share/alternc/panel/admin
  AssignUserId alterncpanel alterncpanel
  SetEnv LOGIN "%%UID%%-%%LOGIN%%"
  ServerName %%fqdn%%
  RewriteEngine on
  RewriteRule   ^/admin/(.*)  /$1
  
  alias /alternc-sql      /usr/share/phpmyadmin

  RewriteEngine On
  RewriteRule ^webmail /webmail-redirect.php [L]

  # Mail autoconfig
  RewriteRule ^mail/mailautoconfig.xml$ /mailautoconfig_thunderbird.php [L]
  RewriteRule ^mail/config-v1.1.xml$ /mailautoconfig_thunderbird.php [L]
  RewriteRule ^autodiscover/autodiscover.xml$ /mailautoconfig_outlook.php [L]
  RewriteRule ^Autodiscover/Autodiscover.xml$ /mailautoconfig_outlook.php [L]
  RewriteRule ^Autodiscover.xml$ mailautoconfig_outlook.php [L]
  RewriteRule ^autodiscover.xml$ mailautoconfig_outlook.php [L]

  # will be used to define aliases such as /javascript /squirrelmail ...
  Include /etc/alternc/apache-panel.d/*.conf

  SSLEngine On
  SSLCertificateFile %%CRT%%
  SSLCertificateKeyFile %%KEY%%
  %%CHAINLINE%%

</VirtualHost>
