This is not an elegant solution, but after a few months it is the only way to find it.
Ordinary case
domain.tld/dir/file.php?id=UID&qty=NUM&... (from old site structure)
corresponded as
domain.tld/newfile.php?id=UID&qty=NUM&... [R=301,L]
So for queries like
domain.tld/dir/file.php%3Fid%3DUID%26qty=NUM%26... (from old site structure)
Doing
RewriteRule ^dir/file\.php(.*)$ script.php?qs=$1 [R,L]
This MUST AFTER all directives related to dir / file.php
Then I can process the query string $ _GET ['qs'] in script.php
It may not apply to other situations that enter into a cycle or unwanted results.
source share