RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Handle OPTIONS requests before hitting PHP
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^.*$ - [R=200,L]

# Send CORS headers at the server level
<IfModule mod_headers.c>
    Header always set Access-Control-Allow-Origin "https://forjwell.com"
    Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
    Header always set Access-Control-Allow-Headers "Content-Type, Authorization"
</IfModule>

# All other requests go to index.php
RewriteRule ^ index.php [QSA,L]

# php -- BEGIN cPanel-generated handler, do not edit
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
