Remove parts of Url using htacess

Let me explain in brief. I have a FB Button on my product page, if anyone clicks the like button on it. My page comes under Activity tab on Facebook, so if anyone clicks my page link in facebook, it redirects back to my page however facebook adds query string as

www.abcd.com/shop/productx/&fb_action_ids=485653551476299&fb_action_types=og.likes&fb_ref=.UPeDRHNDS9c.like&fb_source=aggregation&fb_aggregation_id=246965925417366

But after this link reaches my site, the internal configuration changes all the & into / which is

www.abcd.com/shop/productx/fb_action_ids/4748009931767/fb_action_types/og.likes/fb_ref/.UPbzP0K2Q0g.like/fb_source/timeline_og/action_object_map/%7B%224748009931767%22:537586299592758%7D/action_type_map/%7B%224748009931767%22:%22og.likes%22%7D/action_ref_map/%7B%224748009931767%22:%22.UPbzP0K2Q0g.like%22%7D

So it is no more a query string and changes into proper url. This makes my site go into Infinite Loop.

Currently my htaccess conf is:

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA]

Kindly help me on how to remove the extra URL added by the facebook

Answers


Adding this above your current rules will remove everything starting from the &fb_action.

RewriteRule ^(.*?)&fb_action /$1 [L,R=301]

Note that I'm assuming this isn't actually a query string, because in your question your URL looks like:

www.abcd.com/shop/productx/&fb_action_...
# no ? here----------------^

Need Your Help

gridlib cell format in python

python format wxpython

I am using a gridlib within wxpanel. I am creating the following grid:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.