Redirecting to a destination with state
I'm looking at the plugin and hit what seems to be the perennial issue.
if you setup a redirect from /a to /b , after creation you can add a querystring and hash to the url and it will be appended to the redirect. Great so far. (/a?tab=2#myheading redirects to /b?tab=2#myheading)
However if you say want to redirect to a destination containing a hardcoded querystring/hash then that's not possible as it gets stripped from the redirect on save. (from /a to /b?tab=2#myheading.
The use case is publishing a short url in print and it loading say a page with certain state. Another usecase is a redirect to a javascript app that handles internal state.
I might be able to have time to look at this. Is it desired, or have people solved this another way?
For reference, some earlier work on this https://github.com/humanmade/hm-redirects/pull/55
Ultimately it was very hard to make this work in a performant way but always good to have another pair of eyes on a problem.
After discussions a smaller version of the problem that #55 tries to tackle is simply allow query string and url hashes in the destination, merging with ( and overwriting) any in the input.
This avoids complexity and performance issues:
Example:
with a redirect from /a to /b?tab=2#myheading
-
and a user input of
/a?tab=1or/athe result is the destination, -
for
/a?what=thisthe result is/b?what=this&tab=2#myheading