# =====================================================================
#  NADIPLAY  ·  outer .htaccess  ·  public_html/4kmovies.vip/nadiplayer/
# =====================================================================
#
# This file does TWO things:
#   1. Lets React Router handle client-side URLs like /nadiplayer/pair,
#      /nadiplayer/login, etc. — Apache falls back to index.html.
#   2. Leaves /nadiplayer/api/* alone so the api/.htaccess inside the
#      api/ subfolder takes over and routes those to api/index.php.

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

  # Do NOT rewrite anything under /nadiplayer/api/ — those go to PHP.
  RewriteRule ^api(/|$) - [L]

  # Real files and folders are served directly.
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Everything else → single-page app.
  RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css               "access plus 1 year"
  ExpiresByType image/png              "access plus 1 month"
  ExpiresByType image/jpeg             "access plus 1 month"
  ExpiresByType image/webp             "access plus 1 month"
  ExpiresByType font/woff2             "access plus 1 year"
</IfModule>

<Files "index.html">
  Header set Cache-Control "no-cache, no-store, must-revalidate"
</Files>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>
