# ===== Istilo Salon — Apache / cPanel config =====================

# Serve index.html for the domain root
DirectoryIndex index.html

# --- Force HTTPS and canonical www host --------------------------
# (Safe to keep; only redirects once the SSL cert is active.)
<IfModule mod_rewrite.c>
  RewriteEngine On
  # http -> https
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  # non-www -> www
  RewriteCond %{HTTP_HOST} ^istilosalon\.com [NC]
  RewriteRule ^ https://www.istilosalon.com%{REQUEST_URI} [L,R=301]
</IfModule>

# --- Correct MIME types ------------------------------------------
<IfModule mod_mime.c>
  AddType video/mp4 .mp4
  AddType image/png .png
  AddType application/javascript .js
  AddCharset UTF-8 .html .js .json
</IfModule>

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

# --- Browser caching ---------------------------------------------
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType application/javascript "access plus 7 days"
  ExpiresByType image/png "access plus 30 days"
  ExpiresByType image/jpeg "access plus 30 days"
  ExpiresByType video/mp4 "access plus 30 days"
  ExpiresByType image/x-icon "access plus 30 days"
</IfModule>

# --- Security headers --------------------------------------------
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# --- Pretty error page (optional) --------------------------------
ErrorDocument 404 /index.html
