builds returnURL from URL called on