# php handler
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php83 .php .php8 .phtml
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On

# Serve specific HTML pages BEFORE checking for static files
# These take priority over Next.js routing
RewriteRule ^login/?$ /login.html [L]
RewriteRule ^register/?$ /register.html [L]
RewriteRule ^about/?$ /about.html [L]
RewriteRule ^themes/?$ /themes.html [L]

# Allow direct access to static files and directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Route /api requests through api-proxy.php
RewriteCond %{REQUEST_URI} ^/api
RewriteRule ^(.*)$ api-proxy.php [QSA,L]

# Fallback to index.html for SPA routes
RewriteRule ^$ /index.html [L]
</IfModule>

# Disable directory listing
Options -Indexes
