# Enable Gzip Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/json
</IfModule>

# Set Cache Headers for Static Assets
<FilesMatch "\.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$">
  Header set Cache-Control "max-age=31536000, public"
</FilesMatch>

# Set Cache Headers for HTML
<FilesMatch "\.(html)$">
  Header set Cache-Control "max-age=3600, public"
</FilesMatch>

# Prevent access to sensitive files
<FilesMatch "^(\.env|\.git|package\.json|tsconfig|vite\.config)">
  Order allow,deny
  Deny from all
</FilesMatch>

# Prevent directory listing
Options -Indexes

# Enable HTTPS redirect (uncomment if you have SSL)
# <IfModule mod_rewrite.c>
#   RewriteEngine On
#   RewriteCond %{HTTPS} off
#   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# </IfModule>
