Facebook not able to scrape my url Facebook not able to scrape my url codeigniter codeigniter

Facebook not able to scrape my url


The Facebook documentation includes details on the Open Graph Protocol and how to include the correct meta tags so that Facebook can scrape your URL accurately.

https://developers.facebook.com/docs/opengraphprotocol/

Essentially what you'll want to do is include some special og:tags instead (or in addition) to your existing meta tags.

  <head>    <title>Ninja Site</title>    <meta property="og:title" content="The Ninja"/>    <meta property="og:type" content="movie"/>    <meta property="og:url" content="http://www.nin.ja"/>    <meta property="og:image" content="http://nin.ja/ninja.jpg"/>    <meta property="og:site_name" content="Ninja"/>    <meta property="fb:admins" content="USER_ID"/>    <meta property="og:description"          content="Superhuman or supernatural powers were often                   associated with the ninja. Some legends include                   flight, invisibility and shapeshifting..."/>    ...  </head>

If you have an .htaccess file redirecting things and making it difficult for Facebook to scrape your URL you might be able to get away with detecting Facebook's crawler with your .htaccess and feeding it the correct tags. I believe the the user agent that the Facebook crawler provides is this :

facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)

The documentation also has a section talking about making sure that their crawlers can access your site.

Depending on your configuration you can test this by looking at your servers access_log. On a UNIX system running apache, the access log is located at /var/log/httpd/access_log.

So you could use an entry similar to this in your .htaccess file -

RewriteCond %{HTTP_USER_AGENT} ^facebookexternalhitRewriteRule ^(.*)$ ogtags.php?$1 [L,QSA]

The [L,QSA] flags that I placed there state that this is the L​ast rule that will be enforced on the current request (L) and the QSA (Query String Append) states that any query string given will be passed along when the URL is rewritten. For example, a URL such as :

https://example.com/?id=foo&action=bar

Will be passed to ogtags.php like this - ogtags.php?id=foo&action=bar. Your ogtags.php file will gave to generate dynamic og:meta tags according to the parameters that were passed.

Now whenever your .htaccess file detects the Facebook user agent, it will pass him the ogtags.php file (that can contain the correct og:meta information). Please be aware of any other rules you have in your .htaccess and how they might affect new rules.

From the .htaccess entries that you have detailed, I would recommend placing this new "Facebook rule" as the very first rule.


I had the same problem, which was:Bad Response Code: URL returned a bad HTTP response code.

but oddly this is what solved it:I've added

    <meta property="og:locale" content="en_US" />

to my site HEAD tag and it worked.

Also, not to forget, in your application dashboard (where you get your APP ID) you must have atleast "Website with Facebook Login" enabled and enter the URL of the website.Otherwise it won't work...regardless if you are not using any Facebook Logins on your site.