# RoyalCity — clean URLs (no .php). Requires mod_rewrite (enabled by default in XAMPP).
Options -MultiViews -Indexes
DirectoryIndex index.php index.html

<IfModule mod_rewrite.c>
RewriteEngine On

# 1) Visiting /page.php (GET) redirects to /page. POST/AJAX to .php still works untouched.
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{THE_REQUEST} \s(\S+?)\.php(\?\S*)?\sHTTP/ [NC]
RewriteRule ^ %1%2 [R=301,L,NE]

# 2) /page is served by page.php when that file exists.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
</IfModule>

<IfModule mod_headers.c>
  # Hosting (LiteSpeed/cPanel) was sending: Permissions-Policy: microphone=()
  # which blocks the AI voice mic online. Force-allow microphone for this app.
  Header always unset Permissions-Policy
  Header always set Permissions-Policy "geolocation=(), camera=(), payment=(), microphone=*"

  # Keep app JS/CSS fresh so voice fixes are not stuck behind browser/proxy cache.
  <FilesMatch "\.(js|css)$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
</IfModule>
