<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /bouabdelli/

  # 1. Force HTTPS to fix the CORS Error
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # 2. Let the Laravel API handle its own routes
  RewriteCond %{REQUEST_URI} ^/bouabdelli/api/ [NC,OR]
  RewriteCond %{REQUEST_URI} ^/bouabdelli/laravel_core/ [NC]
  RewriteRule ^ - [L]

  # 3. Fix the 404 F5 Error (Send all other traffic to React)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.html [QSA,L]
</IfModule>