<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Paystack sends its webhook signature in this header
    RewriteCond %{HTTP:X-Paystack-Signature} .
    RewriteRule .* - [E=HTTP_X_PAYSTACK_SIGNATURE:%{HTTP:X-Paystack-Signature}]

    # Send requests to the front controller unless a real file exists
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

<FilesMatch "^\.">
    Require all denied
</FilesMatch>
