RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]


<IfModule mod_headers.c>
    # Allow all origins to access resources (allow any domain)
    Header set Access-Control-Allow-Origin "*"

    # Allow specific methods (optional)
    Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"

    # Allow specific headers (optional)
    Header set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With"

    # Allow credentials (optional, usually false when allowing all origins)
    Header set Access-Control-Allow-Credentials "true"

    # Handle OPTIONS method (preflight request)
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_METHOD} OPTIONS
        RewriteRule ^(.*)$ - [R=200,L]
    </IfModule>
</IfModule>

