<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # 1. API Reverse Proxy (Optional: Uncomment if hosting Node.js backend on same cPanel via PM2/Custom Port)
  # Replace 3001 with your actual backend port
  # RewriteRule ^api/(.*)$ http://127.0.0.1:3001/api/$1 [P,L]

  # 2. React SPA routing
  # Serve existing files/directories, otherwise redirect to index.html
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
