Correctly resolve relative URIs with a query string.