# ATUS Weiz – Webserver-Konfiguration (Apache, Hetzner Managed Server)

Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Authorization-Header an PHP durchreichen (Basic Auth der REST-API,
    # geht bei FastCGI/PHP-FPM sonst verloren)
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Alte Drupal-Adressen der Form /index.php/sportart/judo auf saubere Pfade umleiten
    RewriteCond %{THE_REQUEST} \s/+index\.php/([^\s?]*)
    RewriteRule ^index\.php/(.*)$ /$1 [R=301,L]

    # Bestehende Dateien und Verzeichnisse direkt ausliefern
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Alles andere an den Front-Controller
    RewriteRule ^ index.php [QSA,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>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg    "access plus 30 days"
    ExpiresByType image/png     "access plus 30 days"
    ExpiresByType image/webp    "access plus 30 days"
    ExpiresByType image/svg+xml "access plus 30 days"
    ExpiresByType text/css      "access plus 7 days"
    ExpiresByType application/javascript "access plus 7 days"
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript text/plain application/json image/svg+xml
</IfModule>
