0

I wondering, how to not requesting bots like google crawler or bing crawlers to login since they can crawl my post info, but require user to login if they want to see the posts?

I already know how to redirect user to login page, but don't know how to exclude the crawlling bots!

function wpse_41699_wp(){
    if( is_page('Login')||is_page('register')||is_page('Blog')||is_page('blog') ){
        return;
    }else{
        if(!is_user_logged_in()){
            $url = get_bloginfo('home').'/login';//ACW-login location need to be specified
            header('HTTP/1.1 403 Forbidden');
            header("Location: $url");
            exit;
        }
    }
}

Thanks!

Or is there better way to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.