properly construct the redirecting url