Is there a better way to construct this redirect URL?