# Buat file .htaccess di root folder
# Atur browser caching untuk mempercepat loading
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType image/svg+xml "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresDefault "access 1 month"
</IfModule>

# Enable compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/x-javascript application/json
</IfModule>

# Pengaturan Cache untuk mengurangi kedipan
<IfModule mod_headers.c>
  # Cache untuk JS dan CSS
  <FilesMatch "\.(js|css)$">
    Header set Cache-Control "max-age=2592000, public"
  </FilesMatch>
  
  # Cache untuk gambar
  <FilesMatch "\.(jpg|jpeg|png|gif|ico|webp)$">
    Header set Cache-Control "max-age=31536000, public"
  </FilesMatch>
  
  # Cache untuk font
  <FilesMatch "\.(woff|woff2|ttf|eot|svg)$">
    Header set Cache-Control "max-age=31536000, public"
  </FilesMatch>
</IfModule>

# Kompresi untuk file
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/javascript application/json
</IfModule>