PHP删除扩展并重写$ _GET请求

I'm trying to rewrite PHP URLs from: example.org/file.php?param=val&param=val

to: example.org/file/param/val/param/val

With every PHP file on my server, but I can't figure it out. My .htaccess will remove the .php extension, but I can't get it to rewrite $_GET requests.

If somebody can help me out that'd be great. Also, I plan on using nginx for production, so I'd appreciate it if somebody can help me convert the .htaccess to be compatible with nginx.

Thanks!

Edit: This is my current .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

No direct experience with it, but this page indicates you want to use a RewriteCond to look for the query string, and apply a regex matching pattern to the same. That pattern's matchs will then be available in your rewrite rule.

So, if I understand that correctly, the following

RewriteCond %{QUERY_STRING}     ^query=(.*)$    [NC]
RewriteRule ^/old-search$       /search/(%1)    [NC,L,R=301]

Would match a url like

/old-search?query=something

and turn it into

/search/something

Syntax will probably vary depending on Apache version.