implemented direct_redirect function.