# ************************************
# Vhost template in module sysconfig
# Managed by Puppet
# ************************************

<VirtualHost *:80>
  ServerName <%= @vhost %>

  ## Vhost docroot
  DocumentRoot "/var/www/corpusdelaparole/drupal"

  ## Alias declarations for resources outside the DocumentRoot
  Alias /corpus-back "/var/www/corpusdelaparole/corpus-back/public"

  <Directory "/var/www/corpusdelaparole/drupal">
    AllowOverride all
    Require all granted
  </Directory>


  <Directory "/var/www/corpusdelaparole/corpus-back/public">
    AllowOverride None
    Require all granted
    IncludeOptional /etc/www/corpus_env.con[f]
    <IfModule mod_rewrite.c>
      <IfModule mod_negotiation.c>
        Options -MultiViews
      </IfModule>

      RewriteEngine On
      RewriteBase /corpus-back/

      # Redirect Trailing Slashes...
      RewriteRule ^(.*)/$ /corpus-back/$1 [L,R=301]

      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
    </IfModule>
  </Directory>

  ## Logging
  ErrorLog "/var/log/httpd/corpusdelaparole_error.log"
  ServerSignature Off
  CustomLog "/var/log/httpd/corpusdelaparole_access.log" combined

</VirtualHost>
