'RewriteCond exclude specific folders and HashTag

I'm struggling with a rewrite Condition.

I need to add a Parameter (service=xy) to all URL.

Except if the URL Contains the folder /folder1, /folder2, a Hashtag or already has the parameter (service=xy).

I tried this, but it doesn't work

RewriteCond %{QUERY_STRING} ^(?i)(?!service|#)
RewriteCond %{REQUEUST_URI} !^(/folder1|/folder2)$
RewriteRule $ ?service=xy [L,R,QSA]

Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source