added method to get ending url in redirect