Reputation: 2396
On my website i have facebook comment form. So, when some user answered on facebook comment, comment's author receives message with link looks like http://somesite/?p=650336994452395724_787132&fb_comment_id=fbc_206901222839669_334304_206901256172999#f2c762c5d4
but comments avaiable only by http://somesite/?p=650336994452395724_787132
url.
So, i need to remove all parameters after http://somesite/?p=650336994452395724_787132
by .htaccess. I've tried to do that with next code
RewriteCond %{QUERY_STRING} fb_comment_id=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]
but it gives me wrong url.
Upvotes: 1
Views: 365
Reputation: 785481
You can use this rule:
RewriteCond %{QUERY_STRING} ^(p=[^&]+)& [NC]
RewriteRule ^ %{REQUEST_URI}?%1# [R=302,L,NE]
Upvotes: 1