# Apache: the document root is public/ (docs/DEPLOYMENT.md). Every request that is not a file here
# goes to index.php; dotfiles are never served.

Options -Indexes
DirectoryIndex index.php
ServerSignature Off

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On

    # Pass the Authorization header through to PHP (API keys and tokens).
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Never serve dotfiles, except /.well-known (certificates).
    RewriteRule (^|/)\.(?!well-known/) - [F,L]

    # Front controller.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

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

<IfModule mod_headers.c>
    # Vite's built files carry a content hash in their names: a new build makes new names.
    <FilesMatch "\.(css|js|woff2?)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>
</IfModule>
