Is it possible to access a modified query string in a RewriteCond after applying a RewriteRule?
What I'm trying is to apply ...
RewriteCond %{QUERY_STRING} ^(.*)&?id=([^&]+)&?(.*)$ [NC]
RewriteRule ^/app\.jsp$ /app/%2?%1%3 [R=302]
... to rewrite following urls into "nice" ones. That already works, but for (2) and (3) there are still unneccessary trailing "?" and "%" chars that I'd like to remove:
/app.jsp?id=123&b=1 -> /app/123?b=1 (1)
/app.jsp?id=123 -> /app/123? (2)
/app.jsp?b=1&id=123 -> /app/123?b=1& (3)
My idea is to add additional conditional RewriteRule's to remove the trailing "?" and "%" chars from the modified query string but I don't know how to access the latter within subsequent RewriteCond's. Thank you for any hints.