function in redirect