created code for redirecting pages