# Aegle Connexus (PHP) — Apache routing.
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Pass the Authorization header through to PHP (needed on CGI/FPM hosts).
  RewriteCond %{HTTP:Authorization} .
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # API requests.
  RewriteRule ^api(/.*)?$ api/index.php [L,QSA]

  # Existing files (scripts, styles, images) are served as they are.
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ - [L]

  # Every other address (/login, /emt, /admin/hospitals, ...) is a page of
  # the web app, which decides what to show.
  RewriteRule ^ index.php [L]
</IfModule>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# The page template is served through index.php.
<Files "index.html">
  Require all denied
</Files>

# Never serve configuration, notes or logs.
<FilesMatch "\.(md|log|sql|example\.php)$">
  Require all denied
</FilesMatch>
