Tech - Programming
By: - at April 2, 2013

How To Remove FaceBook Action Ids From URL

A lot of times when people click the FaceBook "Like" button on a page somewhere, in FaceBook, the URL for the Liked page has a bunch of parameters appended onto it, that looks similar to this:
 
http://www.example.com/genre/path/file.html?fb_action_ids=10200381319404048&fb_action_types=og.likes&fb_source=aggregation&fb_aggregation_id=288381481237582

Facebook ParameterNOTE:  The bolded stuff is the extra parameters we do not want.

The problem with this is when someone clicks this link in facebook, they will land on that exact URL.  These are the negatives to having this as the URL:

  • This may cause a whole new Like Button (for that URL), and the real Like Button will not be shown.
  • People copy and pasting this URL and sharing it with others will be inefficient.
  • This could cause your comment system to not work appropriately, because this would be on a different URL.
  • This just looks plain ugly!

Same thing with Facebook's comment system.  When people make a comment using Facebook's comment system and they also "post" that comment to facebook, it will cause another nasty URL inside Facebook for people to click on, that looks similar to this:

http://www.example.com/genre/path/file.html?fb_comment_id=fbc_10150288526035050_19220968_10150359102705050

NOTE:  The bolded stuff is the extra parameters we do not want.

This has the same problems as with the Like button.

So How do We Remove These Parameters?
So how do we make it so the ( ?fb_action_ids= ) and the ( ?fb_comment_id= ) does not show in the URL when people click on these from FaceBook?

This can be done via the .htaccess file.  And this is the exact code I put in my .htaccess file to make this work:

RewriteCond %{QUERY_STRING} fb_action_ids=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]

RewriteCond %{QUERY_STRING} fb_comment_id=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]

NOTE:  This works great for me.  I looked everywhere for this answer and I finally found it, that is why I would like to share this with everyone.

What this code does is anytime the string fb_action_ids= or fb_comment_id= is appended onto the URL, these HTACCESS commands will simply strip them away causing them not to show on the URL landing page.


 

 

 

 

Programming
Introduction to Java EE (Part 1)
How the Google App Engine Works
WSDL - Web Service Description Language
SOAP: Simple Object Access Protocol
Initiation to Cryptography and Encryption to Secure Data
Introduction to Design Patterns in Java
How To Write Efficient Programs in Java
Proper Management of Logs in .Net
How To Remove FaceBook Action Ids From URL


Copyright 2017 YurTopic All rights reserved.

Protected by Copyscape Online Plagiarism Software

There has been a total of

hits counter
Unique Visitors to YurTopic
(Since January 1st 2013)

About  |  Terms and Conditions  |  Contact