Facebook Like Buttons, &fb_xd_fragment=, Blank pages and SEO

April 17, 2011

This is a problem that's been around for months now and yet still bugs thousands of users.

Any of your pages with facebook widgets on can result in URL's like www.example.com/page.php?fb\_xd\_fragment=.

This has several implications. Firstly - it can cause blank pages through unwanted interactions with div areas on the page. We can solve this by adding the following fix just before the </body> tag. This came from http://forum.developers.facebook.net/viewtopic.php?id=60571&p=1 (temporary solutions).

<!-- Correct fb_xd_fragment Bug Start -->
<!-- Correct fb_xd_fragment Bug End -->

The second, more long term issue is that this page will appear in search results alongside the normal page...resulting in duplicate content. Obviously you could just remove the like button but that's not an ideal solution. So you can do a couple of things.

Head to webmastertools (https://www.google.com/webmasters/tools/home) and add the fb_xd_fragment= as something that should be ignored on your site.

Filtering out fb_xd_fragment in Google Webmaster Tools

Filtering out fb_xd_fragment in Google Webmaster Tools

Another option is to use .htaccess and 301 redirects to clip out the &fb_xd_fragment=, which is a pain but very easily do-able and removes the requirement to put the display fix on every page. So try this (modified per your site) in your .htaccess:

RewriteCond %{QUERY_STRING} fb_xd_fragment=  
RewriteRule ^(.*) http://www.example.com/$1? [R=301]

Note: This is now fixed.

Profile picture

From Dave, who writes to learn things. Thoughts and views are his own.

© 2023, withdave.