Home



Facebook this message contains blocked content that has previously been flagged as abusive or spammy

Debugging War Stories

We have recently been called to investigate a Facebook wall post ban. Facebook is a big factor in getting traffic today so having your domain banned is a big thing. It can scratch out a significant part of your traffic. What does it mean to be banned by someone so infuential as facebook? It can only be compared to being delisted on Google. Here's how to recover now.

First thing you need to do is register a new domain. Maybe one with a small typo in it but most importantly a new domain that is not banned (yet).

Create a script at a URL on the new domain that you are going to post to facebook. For example http://new-domain.com/facebook.php

When script is invoked just return a Location header and a 302 HTTP response. This will make it so that when users click on your wall post they get redirected to the original blocked domain. However this will also make facebook ban the new domain as well because it will soon detect that it links to a banned domain. To prevent from this we'll use a simple technique to detect if facebook's bots that are visiting our wall post script or it's a real user. If we detect facebook bot we'll return a dummy page. If it's a real user we'll redirect to banned domain.

Now post http://new-domain.com/facebook.php on facebook and when users click it they'll get to your original site. You'll need to add some dummy content on the new domain. Facebook will be turning to it when it tries to fetch post images and text description the URL you posted.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

function getwhois($IP)
{
    
$whois  = array();
    
$server "whois.arin.net";
    
$fp     = @fsockopen($server43, &$errno, &$errstr15);
    if (!
$fp) {
        return 
false;
    } else {
        
fputs($fp"$IP\r\n");
        
        while (!
feof($fp)) {
            
$whois[] = fgets($fp256);
        }
        
        
fclose($fp);
    }
    
    
$whois implode($whois'');
    return 
$whois;
}

$whois getwhois($_SERVER['REMOTE_ADDR']);

if (
preg_match('/facebook/i'$whois)) {
    
header('Location: http://new-domain.com');
    die();
}

header('Location: http://banned-domain.com');

?>

This is the code we are using to detect if visitor is facebook or a real user.

You can try it out here:



Enter final URL you want your users to land on when they click on the wall post.



Enter a preview URL you want Facebook to use when extracting og: meta tags and images. Don't enter your banned domain here! This is not needed if you are generating the wall post content programatically.





Veselin Kulov
10 Sept 2011