<IfModule mod_rewrite.c>
    RewriteEngine On
    Options -Indexes

    # Otomatis Force HTTPS (Nonaktifkan jika tidak pake SSL/HTPPS di localhost)
    # RewriteCond %{HTTPS} off
    # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

# Security: Deny access to sensitive log/txt files
<FilesMatch "\.(txt|log|key)$">
    Order Deny,Allow
    Deny from all
</FilesMatch>

# Ensure correct MIME type for Service Worker & JSON Manifests
<IfModule mod_mime.c>
    AddType application/javascript .js
    AddType application/json .json
</IfModule>
