With htaccess I am using:
<IfModule mod_headers.c>
    Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; 
    style-src 'self' 'unsafe-inline'; frame-src 'self' *.youtube.com; img-src * data:; media-src * data:; 
    report-uri /logging"
</IfModule>
However, I need to exclude all pages that contain Paypal scripts because Paypal writes into the DOM and this gets blocked by the Content-Security-Policy.
Now with htaccess I try to exclude CSP using a condition, so Paypal is not blocked anymore.
How can I exclude URLs that start with /order and /paypal?
Examples of domains:
https://www.example.com/order/checkout
https://www.example.com/paypal
https://www.example.com/paypal/check
Can I use Files or FilesMatch inside the IfModule?
Maybe like this?
<IfModule mod_headers.c>
    <FilesMatch "\(order|paypal)">
        Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src 'self' *.youtube.com; img-src * data:; media-src * data:; report-uri /logging"
    </FilesMatch>
</IfModule>
But I need the oppsite, if NOT FilesMatch.
Meanwhile I found this negative lookahead regex to exclude e.g. "order": ^((?!order).)*$ - and for "order" and "paypal" this regex should work: ^((?!order)(?!paypal).)*$
I tried it but it does not seem to work:
<IfModule mod_headers.c>
    <FilesMatch "^((?!order)(?!paypal).)*$">
        Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src 'self' *.youtube.com; img-src * data:; media-src * data:; report-uri /logging"
    </FilesMatch>
 </IfModule>
I also tried ^(?!.*(order|paypal)$).*$ without success. It shows as valid in Regex101 but does not seem to work with Apache's htaccess.
 
    