Website Administration Services

Website FaceBook fb_xd fragment


Website Administrator Know How Articles

Social Networks Series

Website Sponsors for Jobs

Apache FaceBook Like Button fb_xd_Fragment Fix


Fixing the FaceBook Like button back link.

Now that you've added the facebook like button, you may wish to add a little code to your apache .htaccess file to stop facebook assigning their own url to your pages which can cause various types of random havoc. Eg. some cases have reported that the facebook link will cause a blank page to appear in internet explorer.

And you should really be making sure your are using the Rel Tag Canonical (see our article on How to insert and use the Canonical Link Rel tag) which can assist Google in sorting out any anomalies in linking to your correct page in the Google Index. This is almost mandatory if you are using Google's plusone feature. It appears that plusone uses this as the field to get the data to link to your page. This is a more sensible approach to get a page link.

I had no problem using the following apache facebook correction code for the like url for i.e. which i thought was surprising, and as it turns out, the other browsers might be just fine too.

When i get around to checking my pages in internet explorer, i use Version 8. I'm not sure if anyone actually uses i.e. much anymore. It's so last centaury.

And FaceBook should take note as I am sure i am not the only html coder that has long been tired of having to rewrite standard webcode each time i.e. updates. And facebook already are trying to change the face of standard html. Enough of my whining, let's get to the fix.

Apache rewrite Code

This code drops the fb_xd_fragment query and tells google that the referring url (the facebook url) has been changed back to the original. This is an edit to the apache .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine ON
#Facebook Redirect For Added String
RewriteCond %{QUERY_STRING} .*fb_xd_fragment.*
RewriteRule ^(.*)$$1? [R=301,L]

FireFox and Chrome woes with the fb_xd_fragment

There appeared to be a need to sort this out further in firefox and chrome, however, this might might have been a cache response I was seeing where the apache corrected code seemed to then hang on the first # character in the url string. I will revisit this shortly and report on what i find. But at least the page is up and loading and seems to be reported correctly in statcounter so i am happy for the moment.

Well, I re-visited this after a week or so and statcounter's reported landing page from the facebook like button hits are no longer showing as an incorrect url. So, at this time, i will assume that what i was seeing in the above paragraph was just a cache glitch. The amended .htacces code appears to be doing it's thing correctly and i am a firm believer that if something that was not working is now working, then you don't need to fix it any further.