edit redirect function