RewriteEngine On

# --- PRIORITY 1: Security & Consistency ---
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Force non-www
RewriteCond %{HTTP_HOST} ^www\.kinlyr\.com [NC]
RewriteRule ^(.*)$ https://kinlyr.com/$1 [L,R=301]
# ------------------------------------------

# Set proper MIME types
AddType application/javascript .js
AddType text/css .css

# Enable CORS (Careful: This allows all origins)
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

# Routing: Serve index.html if file not found
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]