# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# JOEL CRASTA PORTFOLIO - cPANEL APACHE CONFIGURATION
# Optimized for high speed static load + real PHP Gemini connection proxying
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Disable indexing for absolute security
Options -Indexes

# Ensure rewrite engine is active
RewriteEngine On

# 1. ROUTE API CALLS TO THE PHP PROXY ENERGETICALLY
# Rewrite /api/chat directly to the PHP handler
RewriteRule ^api/chat$ api/chat.php [L,QSA]

# 2. SEAMLESS FALLBACK ROUTING FOR REACT FRONTEND
# If the requested filename does not exist on disk as a file or directory...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ...silently forward the request back to index.html for React standard client routing
RewriteRule ^ index.html [L]
