<IfModule mod_rewrite.c>
    RewriteEngine On

    # ==========================================
    # FORCE HTTPS
    # ==========================================
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://shop.prajasapphire.my.id%{REQUEST_URI} [L,R=301]

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

    # Redirect Trailing Slashes (except root)
    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>

# ==========================================
# SECURITY HEADERS
# ==========================================
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
</IfModule>

# ==========================================
# DISABLE DIRECTORY LISTING
# ==========================================
Options -Indexes