How to Stop Facebook To Crawl or Track your Website Pages

If you website have lot of pages and you want to block facebook then you can do this by adding simple 3-4 line code in your header.php file but before we explain this we will explain why many blogger or web owner do this .

Reason of blocking Facebook crawler from website

Facebook crawl and save og data in there server , which is used by facebook server when anyone share anything from website , some site with huge amount of pages block this because crawler some time put load on server and many webmaster thinks its waste allowing facebook to crawl whole website as they are not using facebook buttons .So they prefer to block facebook from there website.

 

$ua = $_SERVER[‘HTTP_USER_AGENT’];
if (preg_match(‘/facebookexternalhit/si’,$ua)) {
header(‘Location: no_fb_page.php’);
die() ;
}

 
Paste above code in header.php file

How it will Impact your Facebook Traffic

It will not impact your social traffic because it will only block crawler to Crawl your website , It will not impact your facebook like or share button because above code will only stop crawler to crawl your website , when anyone share your article manually then facebook will fetch that data from your web page or blogs.

This code will stop facebook crawler to crawl your website. All those who are not using any facebook button are recommended to use this stuff ,Forum website , question answer website and all other website having thousand of pages are recommended to use this setting if you dont want to slow your web performance.

Advertisement