Added more conditions on redirects