# Enable CORS for API
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With"

# Handle preflight requests
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

# Protect sensitive files
<FilesMatch "\.(md|txt)$">
    Order allow,deny
    Allow from all
</FilesMatch>

# Enable PHP error display for development (disable in production)
# php_flag display_errors on
# php_value error_reporting E_ALL

