Checking if a user is logged in, if so redirect to a different page

I am not sure if you just simplified for example, but make sure you use full URL in wp_redirect() call.

Also rather than having it in template, I think it would be more appropriate to run this at template_redirect hook.

tech