{% if kimai_web_alias is defined and kimai_web_alias != False %}
Alias /{{ kimai_web_alias | regex_replace('^/','') }} {{ kimai_root_dir }}/app/public
{% else %}
# No alias defined, create a vhost to access it
{% endif %}

<Directory {{ kimai_root_dir }}/app/public>
  AllowOverride All
  Options FollowSymLinks
{% if kimai_src_ip is defined and kimai_src_ip | length > 0 %}
  Require ip {{ kimai_src_ip | join(' ') }}
{% else %}
  Require all granted
{% endif %}
  <FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php-fpm/{{ kimai_php_fpm_pool | default('kimai_' + kimai_id | string) }}.sock|fcgi://localhost"
  </FilesMatch>

  RewriteEngine On

  FallbackResource /index.php

  <FilesMatch "(\.git.*)">
    Require all denied
  </FilesMatch>

</Directory>

<Directory {{ kimai_root_dir }}/public/bundles>
  FallbackResource disabled
</Directory>
