Refine the redirect check condition