<IfModule mod_rewrite.c>
    Options -Indexes
    # If your host blocks FollowSymLinks, swap the next line with: Options +SymLinksIfOwnerMatch
    Options +FollowSymLinks

    RewriteEngine On

    # Pass Authorization header (needed for APIs)
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Trailing slash cleanup (optional)
    RewriteRule ^(.+?)/$ /$1 [L,R=301]

    # Front controller
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Protect dotfiles
    RewriteRule (^|/)\. - [F]
</IfModule>

# Ensure PHP files run if your host needs it in this vdir
<IfModule mime_module>
    AddHandler application/x-httpd-ea-php83 .php .php8 .phtml
</IfModule>

# Make sure index.php is preferred
DirectoryIndex index.php index.html
