# .htaccess - Mitra Grafika POS (https://mitra.wakafkehidupan.my.id)
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Teruskan Header Authorization ke PHP (Penting di CGI/FastCGI/LSAPI cPanel)
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

    # Lindungi database SQLite & file sensitif agar tidak dapat diakses publik
    RewriteRule ^data/.*$ - [F,L]
    RewriteRule \.(db|sqlite|sqlite3|log|ini|bak|sql)$ - [F,L]

    # Arahkan seluruh request /api/* ke api.php
    RewriteRule ^api/(.*)$ api.php?route=$1 [QSA,L]

    # File atau folder fisik tetap disajikan langsung
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # SPA Fallback untuk Clean URLs
    RewriteRule ^.*$ index.html [L]
</IfModule>

<IfModule mod_php7.c>
    php_value upload_max_filesize 32M
    php_value post_max_size 32M
    php_value memory_limit 256M
    php_value max_execution_time 120
</IfModule>

<IfModule mod_php.c>
    php_value upload_max_filesize 32M
    php_value post_max_size 32M
    php_value memory_limit 256M
    php_value max_execution_time 120
</IfModule>

<IfModule lsapi_module>
    php_value upload_max_filesize 32M
    php_value post_max_size 32M
    php_value memory_limit 256M
    php_value max_execution_time 120
</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>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

AddDefaultCharset UTF-8
