DirectoryIndex index.html

# Upload this file to public_html (enable “Show Hidden Files”).
# Do NOT add AddHandler / ea-php lines here — a wrong one makes LiteSpeed return 403
# for every .php file. Set PHP 8.3 in cPanel → MultiPHP Manager instead.

<IfModule mod_negotiation.c>
  Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteCond %{HTTP:Authorization} .
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # /api is a real folder (public_html/api/index.php). Do not send it to the React app.
  RewriteRule ^api(/.*)?$ - [L]

  # Uploaded CMS images
  RewriteCond %{DOCUMENT_ROOT}/backend/public/uploads/$1 -f
  RewriteRule ^uploads/(.*)$ /backend/public/uploads/$1 [L]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^uploads/ - [L]
  RewriteRule ^uploads(/.*)?$ /api/index.php [L,QSA]

  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ - [L]

  RewriteRule ^ /index.html [L]
</IfModule>
