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 for my 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

Any help will be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.