# ============================================
# APLIKASI POS - KONFIGURASI .HTACCESS
# ============================================

# PHP Version - Gunakan PHP 7.4 atau lebih tinggi
# Jika hosting menggunakan cPanel, sesuaikan dengan versi PHP yang tersedia
# Contoh: ea-php74, ea-php80, ea-php81, ea-php82
<IfModule mime_module>
  # Uncomment salah satu baris di bawah sesuai versi PHP hosting Anda:
  # AddHandler application/x-httpd-ea-php74 .php .php5 .phtml
  # AddHandler application/x-httpd-ea-php80 .php .php5 .phtml
  # AddHandler application/x-httpd-ea-php81 .php .php5 .phtml
  # AddHandler application/x-httpd-ea-php82 .php .php5 .phtml
  # Jika tidak yakin, biarkan kosong dan set PHP version via cPanel
</IfModule>

# Enable Rewrite Engine
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  
  # Redirect to index.php if file doesn't exist
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>

# Security: Prevent directory listing
Options -Indexes

# Security: Protect config files
<FilesMatch "^(config\.php|config-sample\.php)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
  </IfModule>
</FilesMatch>

# Set default charset
AddDefaultCharset UTF-8

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

# Cache control for static files
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>
