# TOPUPHIT
DirectoryIndex index.php
Options -Indexes

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# บังคับ HTTPS (ปิดบรรทัดเหล่านี้ถ้าโดเมนยังไม่มี SSL)
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^robots\.txt$ robots.php [L]
  RewriteRule ^sitemap\.xml$ sitemap.php [L]
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !=https
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  # หน้าเกม URL สวย: /topup/rov -> game.php?slug=rov
  RewriteRule ^topup/([a-z0-9-]+)/?$ game.php?slug=$1 [L,QSA]
  # หน้าเว็บไม่มี .php: /rewards -> rewards.php
  RewriteRule ^(admin|credit|login|orders|pay|rewards|signup|terms)/?$ $1.php [L,QSA]
  # คู่มือ / บทความ
  RewriteRule ^guide/?$ articles.php [L,QSA]
  RewriteRule ^guide/([a-z0-9-]+)/?$ article.php?slug=$1 [L,QSA]
</IfModule>

<FilesMatch "\.(sql|md|sample\.php)$">
  Require all denied
</FilesMatch>

# ฟอนต์ในเว็บ
<IfModule mod_mime.c>
  AddType font/woff .woff
  AddType font/woff2 .woff2
</IfModule>
<IfModule mod_headers.c>
  <FilesMatch "\.(woff2?)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
</IfModule>
