try this code,

   

    
    get_header();
    global $current_user;
    get_currentuserinfo();
    
    if(is_user_logged_in()){
        // content for login user
    } 
    else {
    $url = 'http://example.com';
    wp_redirect($url);
        exit();
    }