<IfModule mod_rewrite.c>
    # ============================================================
    # Nama Aplikasi : AQIVO
    # File          : .htaccess
    # Deskripsi     : Aturan rewrite Apache untuk AQIVO.
    # Author        : Habib Ismail Al Qadri
    # Email         : ahlanhabibana@gmail.com
    # Framework     : Laravel 12
    # Dibuat        : Fri 06 November 2026, 10:35 WIB
    # Diubah        : Fri 13 November 2026, 20:10 WIB
    # ============================================================

    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Installer tanpa .php
    RewriteRule ^install\.php$ /install/ [R=301,L]

    # Handle X-XSRF-Token Header
    RewriteCond %{HTTP:x-xsrf-token} .
    RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

# Aset unggahan memakai nama acak sehingga aman di-cache lama; aset lain
# (logo/favicon bisa diganti di nama yang sama) cukup satu hari.
<IfModule mod_setenvif.c>
    SetEnvIf Request_URI "^/uploads/(banners|categories)/" AQIVO_LONG_CACHE=1
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(jpe?g|png|webp|gif|svg|ico|woff2?|ttf|css|js)$">
        Header set Cache-Control "public, max-age=86400"
    </FilesMatch>
    Header set Cache-Control "public, max-age=2592000" env=AQIVO_LONG_CACHE
    Header append Vary Accept-Encoding
</IfModule>

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