RewriteEngine On

# Serve React frontend files
RewriteCond %{REQUEST_URI} !^/api
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.html [L]

# Serve API requests via PHP backend
RewriteCond %{REQUEST_URI} ^/api
RewriteRule ^api/(.*)$ /backend/public/index.php [L]

# php -- BEGIN cPanel-generated handler, do not edit
# This domain inherits the “PHP” package.
# php -- END cPanel-generated handler, do not edit
