propperly append urlsegments preserving query and fragment