Welcome to WebmasterWorld Guest from

Forum Moderators: httpwebwitch & not2easy

Message Too Old, No Replies

Facebook Links now appending query strings?

And it's messing up my pages.



4:19 pm on Oct 20, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

On our product pages we like most have facebook "like" buttons. It's worked great for a couple of years now... visitor clicks like and it posts to their FB page.

Facebook would take the link and when you clicked on it on a persons page it passed through their own php parser page and then would redirect them to our site without the garbage.

Now i'm noticing that there's a bunch of their extra information being passed to our pages. We have our pages set up to 404 any link that has extra stuff to combat confusion with google and to stop some of the spam links we were getting. Seriously we were getting some with querystrings that were pornographic from international locations

What Facebook "like" links look like now is something like this:


This is really fouling things up.


9:44 pm on Oct 20, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

If your web site is hosted on Apache, using Mod_Rewrite/.htacces it would be very easy to 301 redirect any FB Likes URLs back to clean URL.

You could use something like the following in the .htaccess in the root of your web to accomplish this:

RewriteBase /

RewriteCond %{QUERY_STRING} fb_action_ids [NC, OR]
RewriteCond %{QUERY_STRING} fb_action_types [NC, OR]
RewriteCond %{QUERY_STRING} fb_source [NC, OR]
RewriteCond %{QUERY_STRING} fb_aggregation_id [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Note: I'm just winging the above (it hasn't been tested). And I'm sure JDMorgan could come up with a much more elegant solution.

The solution above also assumes that the above code would get executed before any code you have implemented for triggering a 404 when a query string parameter is affected.


10:57 pm on Oct 20, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

That's fantastic! I do use a lot of rewrite... it's out our product pages are rendered. I'll definately test this out.
Thanks so much.

Stupid Facebook! Stupid Google!
I have all the pages set with canonical tags, but never wanted someone linking with a bunch of bs on the end of it.


1:08 am on Oct 21, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Are all pages on this site html? If so, an alternative fix is to turn off

:: shuffling papers ::

AcceptPathInfo. It's a free-standing line in your htaccess:

AcceptPathInfo Off

The horse's mouth [httpd.apache.org] says:

A request will only be accepted if it maps to a literal path that exists. Therefore a request with trailing pathname information after the true filename such as /test/here.html/more in the above example will return a 404 NOT FOUND error.

You can only do this if there is no php or similar on your site, because dynamic pages use the extra part. The default setting-- which is officially called Default-- tells the server to ignore anything after static extensions like "html", but to retain it after dynamic extensions like "php".

In any case there's absolutely no reason for them to be putting in that extra stuff. Do they think you have special php routines that do nice stuff for requests that come in with fb_blahblah queries? Are there CMSs that really do do nice stuff? Hm.

Oh yes. Option C, if the above isn't possible:

RewriteCond %{QUERY_STRING} .
RewriteRule ^([^.]+\.html) http://www.example.com/$1? [R=301,L]


1:15 am on Oct 21, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

It's not php, it's actually asp but we map everything to .htm files since there were old static pages with that extension. 99% of the files really don't exist... they're all done through IIS and ISAPI rewrite.

Side note: Just checked FB and it appears it's only on FB pages that the link is like that. If you have one of the activity boxes on your site it's not linked that way and they resolve fine. Wonder if this is a FB "error".

Featured Threads

Hot Threads This Week

Hot Threads This Month