Removing ? from a query using htaccess

i want to rewrite my url from example.com/page/pipe?test to example.com/page/pipe/test

My concept is just to remove the ? at the end of the page and replace it with a / And i have written a rule to remove the .php extension of my files. below is what code looks like

#REMOVE THE FILE EXTENSION FROM THE URL ESPECIALLY .PHP
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)/$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# Remove ? from /page/pipe.php? and replace it with /page/pipe/
RewriteEngine On
RewriteRule ^page/(.*) pipe.php?$1 [QSA]

my previous code that removes .php makes is possible formy site to be accessed either example.com/page or example.com/page/

but i want every query in pipe.php to be converted to / so that i will have pipe.php?test converted to pipe/test

I always struggle with rewrite rules but I think what you need is

RewriteRule ^page/pipe/([A-Za-z0-9]+)$ /page/pipe.php?$1

Thanks gandalf, i tried it but it didn’t work.
I notice that it works like this example.com/page/pipe.php/test
But not like example.com/page/pipe/test

I don’t want to see the php extension in it