in reply to redirection based on cookie

You can try SSI or mod_rewrite