# Currency Exchange Rate API - .htaccess Configuration
# 
# @author      Molla Samser (Founder)
# @designer    Rima Khatun (Designer & Tester)
# @website     https://rskworld.in
# @contact     help@rskworld.in
# @phone       +91 93305 39277
# @address     Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India - 713147
# @year        2026

# Enable URL rewriting
RewriteEngine On

# API endpoint routing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Route API requests to index.php
RewriteRule ^api/(.*)$ index.php [L,QSA]

# Handle CORS headers
<IfModule mod_headers.c>
    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS"
    Header always set Access-Control-Allow-Headers "Content-Type, Authorization"
</IfModule>

# Cache control for API responses
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType application/json "access plus 1 hour"
</IfModule>

# Security headers
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options nosniff
    Header always set X-Frame-Options DENY
    Header always set X-XSS-Protection "1; mode=block"
</IfModule>

# PHP settings
<IfModule mod_php7.c>
    php_flag display_errors Off
    php_flag log_errors On
    php_value error_log "logs/php_errors.log"
</IfModule>

<IfModule mod_php8.c>
    php_flag display_errors Off
    php_flag log_errors On
    php_value error_log "logs/php_errors.log"
</IfModule>

# Directory protection
Options -Indexes -MultiViews

# Default character set
AddDefaultCharset UTF-8
