Options -Indexes
DirectoryIndex public/index.html index.html index.php

<IfModule mod_rewrite.c>
  RewriteEngine On

  # API lama tetap sama: /api/health, /api/state, /api/competition/..., /api/k3
  RewriteRule ^api(?:/(.*))?$ api.php [QSA,L]

  # Data JSON tidak dibuka langsung dari browser. Akses tetap lewat api.php.
  RewriteRule ^data(?:/|$) - [F,L]

  # Frontend tetap berada di folder public seperti struktur Node.js semula.
  RewriteRule ^$ public/index.html [L]
  RewriteRule ^index\.html$ public/index.html [L]
  RewriteRule ^(assets|css|js|pages)/(.*)$ public/$1/$2 [L]
</IfModule>

<FilesMatch "^(server\.js|package\.json|package-lock\.json|split_manifest\.json|DATA_GRUP_DARI_FOTO\.txt)$">
  Require all denied
</FilesMatch>
