Site icon Hip-Hop Website Design and Development

How to cut off question mark in url with functions.php

I use directive .htaccess

<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} !(^|&)appId=
RewriteCond %{QUERY_STRING} !(^|&)q=
RewriteRule ^(.+?).html$ https://%{HTTP_HOST}/$1.html? [L,R=301]
</IfModule>

The problem would be solved if this RewriteCond %{QUERY_STRING} !^$ replace with this RewriteCond %{THE_REQUEST} ?

But this directive does not work on the Litespeed server.

How to cut (redirect) to a link without a question mark via function.php?

example:
if open website.com/post-name.html? >>>redirect>>> website.com/post-name.html

Sorry for my English.