I'm not sure you got me right.
I think I got you. What I'm trying to say is, with that rule(in my above post), you could obtain a long string in the $_GET['rest']
variable, which would be like
for a request of
Now you may slice this large string with some regexp in PHP, and there by reduce the complexity of your htaccess rule(which is working well now for your initial requirement)
(There must be some other way, but I'm not an expert with this