Search code examples
facebookfacebook-likecanonical-link

Facebook like button - Circular redirect path deteted


Hopefully, someone here can give me some light. I have been researching this issue for a couple of days now, and cannot find a suitable solution.

First of all, I have used the facebook debugger and I understand what the error is, except that I am not sure how to fix it. You can see it here:

http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.viewrecalls.com%2Fshow%3Fq%3DGuidecraft%2520Mega%2520Profit%25204-in-1%2520Dramatic%2520Play%2520Theater%2520Toys%26amp%3Bu%3Dhttp%3A%2F%2Fwww.cpsc.gov%2Fcpscpub%2Fprerel%2Fprhtml12%2F12131.html

I guess, facebook wants me to use either www.viewrecalls.com/show or www.viewrecalls.com in my og:url tag, as both of them passes the validation; however, if I do that, then the information displayed in Facebook will not be the information from the original link, and the user will be redirected to an URL that is not the original one or intended one. I am not sure how to resolve this issue.

My website queries an API and lists the query results. Once you click on a result from the listing page, it goes to a "show" page, where the details of the item clicked is shown. I have "long" QueryString going and one of the parameters is an URL. The QueryString is however encoded, and everything works perfectly, except that the facebook debugger gives me that validation error, and the button is not showing a count, it only shows 0 even though it posts to my facebook wall.

Any help will be greatly appreciated!

Thanks!


Solution

  • Point your og:url tag (on the URL you're pointing a Like button at) to the URL you actually want the user to like, which has the metadata for that URL - image, title, etc

    A circular redirect path almost always means an og:url tag on a page points to another page, which redirects (either by og:url, a canonical ref tag or a HTTP redirect) back to the first page or another page in the redirect chain.

    Facebook's Debug Tool should show you the steps followed and where the redirect is

    {edit} In your case, i'm not 100% sure, but it looks like part of your URL has a & encoded in it, which may be the problem.

    I manually curl

    http://www.viewrecalls.com/show?q=Guidecraft%20Mega%20Profit%204-in-1%20Dramatic%20Play%20Theater%20Toys&u=http://www.cpsc.gov/cpscpub/prerel/prhtml12/12131.html

    and get an og:url tag of

    http://www.viewrecalls.com/show?q=Guidecraft%20Mega%20Profit%204-in-1%20Dramatic%20Play%20Theater%20Toys&u=http://www.cpsc.gov/cpscpub/prerel/prhtml12/12131.html

    which, when i curl THAT, has an og:url of

    http://www.viewrecalls.com/show?q=Guidecraft%20Mega%20Profit%204-in-1%20Dramatic%20Play%20Theater%20Toys&u=http://www.cpsc.gov/cpscpub/prerel/prhtml12/12131.html

    it looks like another & is being added into the URL each time and recursing - should the ampersand not be encoded in a URL as %26?