Add more conditions to avoid redirect.