I migrated my http site to https and lost Facebook comments

Asked

Viewed 79 times

-2

I was doing some tests recently on my blogger website and when I activated the https on my site, I lost Facebook comments.

How do I fix it?

  • Facebook saves the full link from your site, bro, if you change anything in the url structure the comments will disappear.

1 answer

2

In accordance with the facebook documentation, can’t move likes, shares, or comments directly to the new URL, but you can use the old URL as the canonical source for the number of likes or shares in the new URL.

Basic information

When solving which URL a likes or share action should be assigned to, Facebook uses a process to resolve the canonical URL of the URL being loaded. When a URL is loaded, the tracker looks for:

  • A 301 or 302 HTTP Redirect
  • The use of a tag open Graph og:url on the page
  • The use of rel=canonical, as described in RFC 6596. (Facebook tracker supports content only, not HTTP headers.)

If any of these methods result in a URL other than the originally loaded URL, the specified URL will be considered the "canonical URL" of the original URL. If necessary, the tracker will follow a chain of redirects to find the canonical URL.

All likes and shares will be assigned to the canonical URL of the loaded URL.

Examples

Tip: Use our scrubber to see what Facebook sees when it crawls your page.

By controlling the canonical URL, you can move content from one URL to another and keep track of likes and shares, as long as you allow Facebook to continue solving the new URL in the old one. This can be done with one of two methods:

Add a og:url tag to the new URL pointing to the old URL (Preferred) In your new URL, you should include a link to the old URL. For example, if your new URL has https://example.com/new-url and the old URL was https://example.com/old-url, include this snippet in new-url:

<meta property="og:url" content="https://example.com/old-url" />

In the your case, your old url was something like http://foobar.blogspot.com, now this as https://foobar.blogspot.com, then on og:url do this:

<meta property="og:url" content="http://foobar.blogspot.com" />

Using this method tells our tracker that the canonical URL is in the old location, and the tracker will use it to generate the number of likes and shares on the page. New likes and shares will continue to be aggregated also in the old URL.

This also requires the old URL to still process a document with Open Graph tags and return an HTTP 200 response, at least when loaded by the Facebook tracker. If you want other clients to be redirected when visiting the URL, send your 301 HTTP response to all non-Facebook crawler clients. The old URL must contain its own og:url tag that points to itself.

Learn how to recognize your Facebook tracker on Best Sharing Practices Guide.

This method will also work with rel=canonical, but there is a preference for og:url.


Redirect your Facebook tracker to the old URL

Another method of achieving this is redirecting the Facebook tracker to the old URL whenever it visits the new URL. Like the method described above, the old URL must be a valid document with Open Graph headers. And if you want to include a redirect in the old URL, the Facebook tracker should not be redirected when visiting the old URL.

  • top!! thanks.. did not know

  • 1

    It worked perfectly, with the old URL, the page used the properties of the other .

  • @Davidaugustus cool! Could you mark the answer as correct then ? Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.