# ============================================================
# NusaClarity — Image & Video Enhancer Studio
# .htaccess utama (aman untuk Apache + LiteSpeed / shared hosting)
# ============================================================

<IfModule mod_rewrite.c>
    RewriteEngine On
</IfModule>

# Jangan tampilkan daftar isi direktori
Options -Indexes

# Halaman error ramah (opsional, tidak memaksa)
<IfModule mod_php8.c>
    php_value upload_max_filesize 256M
    php_value post_max_size 260M
    php_value max_execution_time 120
    php_value memory_limit 256M
</IfModule>
<IfModule mod_php7.c>
    php_value upload_max_filesize 256M
    php_value post_max_size 260M
    php_value max_execution_time 120
    php_value memory_limit 256M
</IfModule>

# Lindungi berkas sensitif
<FilesMatch "^(config\.php|\.installed|composer\.(json|lock))$">
    Require all denied
</FilesMatch>

# Blokir akses langsung ke folder app/sql/storage
RedirectMatch 403 ^/?(app|sql)/.*$

# MIME untuk PWA
<IfModule mod_mime.c>
    AddType application/manifest+json .webmanifest
    AddType text/javascript .js
</IfModule>

# Service worker harus boleh dikontrol dari root scope
<IfModule mod_headers.c>
    <FilesMatch "sw\.js$">
        Header set Service-Worker-Allowed "/"
        Header set Cache-Control "no-cache"
    </FilesMatch>
</IfModule>
