I'd like to take the following URLs:
- Base:
https://example.com/this/is/base/resource
- Absolute:
https://example.com/this/is/up-one/other-resource?possibly-with=querystring
From there, I'd like to calculate the shortest relative URL from base. For this example, I should get:
../up-one/some-other-resource?possibly-with=querystring
Is there a standard method for doing this? I know there are a lot of edge cases, so before I build it, I wanted to see if a good method already existed.
I know the URL API can go the other way around, which is ultimately what I will be using to go back again.