|CUSTOM1|
|?WWW_PREFIX=www.|
|*if WWW_REDIRECT="no"|
|?WWW_PREFIX=|
|*endif|

|?VH_PORT=`PORT_80`|
|?VHROOT=`HOME`|
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|

|?SSLPROTOCOL=30|
|CUSTOM2|

virtualHost |POINTER|-|VH_PORT| {
  |CUSTOM3|
  user                    |USER|
  group                   |GROUP|
  vhRoot                  |VHROOT|
  setUIDMode              2
  listeners |LISTENERS|

  docRoot                   |DOCROOT|
  vhDomain                  |POINTER|
  vhAliases                 www.|POINTER|
  
  rewrite  {
    enable                  1
    RewriteRule (.*)$ http://|WWW_PREFIX||DOMAIN|/$1 [R=301,L]
  }
  |CUSTOM4|
}

|*if HAVE_SSL="1"|
|?VH_PORT=`PORT_443`|
virtualHost |POINTER|-|VH_PORT| {
  |CUSTOM5|
  user                    |USER|
  group                   |GROUP|
  vhRoot                  |VHROOT|
  setUIDMode              2
  listeners |SSL_LISTENERS|

  docRoot                   |DOCROOT|
  vhDomain                  |POINTER|
  vhAliases                 www.|POINTER|
  
  rewrite  {
    enable                  1
    RewriteRule (.*)$ https://|WWW_PREFIX||DOMAIN|/$1 [R=301,L]
  }

  vhssl  {
    keyFile                 |KEY|
    certFile                |CERT|
    certChain               1
    sslProtocol             |SSLPROTOCOL|
  }
  |CUSTOM6|
}
|*endif|
|CUSTOM7|