Support » Plugin: Really Simple SSL » Social Shares Count Recover After Moving to Https

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author RogierLankhorst

    (@rogierlankhorst)

    You can use a filter to replace it back to https, see this article:

    https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/

    But it depends on your social sharing tool if this will work for your setup. Some tools use their own data attributes to request the share count.

    I need an exception (or filter) for “Auto replace mixed content” so it won’t change the http url on header like this: <link rel=”canonical” href=”http://…&#8221; /> or this: <meta property=”og:url” content=”http://…&#8221; />

    Based on what I read here: https://developers.facebook.com/docs/plugins/faqs#moving-urls

    How do I move a page to a different URL?

    I need to move a page to a different URL, you can’t move the 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 at the new URL. We include background on how to do this below.

    Background

    When resolving which url a like or share action should be attributed to, Facebook uses a process to resolve the canonical url for url that’s been loaded. When a URL is loaded, the crawler will look for:

    A HTTP 301 or 302 Redirect
    The use of an og:url open graph tag in the page
    The use of rel=canonical as described in RFC 6596. (Facebook’s crawler only supports content, not HTTP headers.)

    If any of these methods result in a URL that’s different than the URL originally loaded, the specified URL will be considered the “canonical URL” for the original URL. If required, the crawler will also follow a chain of redirects to find the canonical URL.

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

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    Yes, you can do that with the filter, as explained on the page I posted the link to. You’ll have to adapt the filter slightly so it doesn’t replace data-href=”http:// but your og:url.

    I get your point, thanks for pointing out for me.. 🙂

    Here’s my code and it seems to be working:

    function my_opengraph_url( $url ) {
    global $post;
    $pubDate = get_the_date( $d='U', $post->ID);
    $sslDate = 1490832000;
    if($pubDate < $sslDate) {
    return str_replace( 'https://', 'http://', $url );
    } else {
    return $url;
    }
    }
    add_filter( 'wpseo_opengraph_url', 'my_opengraph_url' );

    function rsssl_exclude_http_url($html) {
    global $post;
    $pubDate = get_the_date( $d='U', $post->ID);
    $sslDate = 1490832000;
    if($pubDate < $sslDate) {
    //replace the https url back to http
    $html = str_replace('og:url" content="https://', 'og:url" content="http://', $html); return $html;
    } else {
    return $html;
    }
    }
    add_filter("rsssl_fixer_output","rsssl_exclude_http_url");

    Do you have any better sugestions?

    Plugin Author RogierLankhorst

    (@rogierlankhorst)

    That looks fine, and should give you a http og:url.

    But this feature is a PAID feature, so whoever wants to provide his visitors safety, he must open his wallet. SO SAD!!

    I have a non-profit story website to promote reading, I put all my time in it. I only have a small unemployment benefit due to my chronical pains, so I have nothing to spend, certainly not 8 dollars monthly. And now I lost all my dearly gained Shareaholic counts, as a kind of punishment to provide my little visitors security!!

    • This reply was modified 2 years, 2 months ago by magdigit.

    Hi @rogierlankhorst, sorry, I just switched to https:// at agodman.com, and I’m at a loss; I’m trying to recover the shares counter from the http… and I installed the simple ssl plugin… – but I still can’t see my shares being “counted up” in the addthis / shareaholic counters on the site….

    Any suggestions?

    Plugin Contributor Mark

    (@markwolters)

    Hi Stefan,

    it seems the og:url of your site is still https://. You can try to add the following code to your theme’s functions.php (first change yourdomain.com into your domain), that will exclude the og:url from the mixed content fixer so it becomes http://.

    function rsssl_recover_shares($html) {
        //replace the https url back to http
        $html = str_replace('og:url="https://www.domain.com', 'og:url="http://www.domain.com', $html);
        $html = str_replace('data-href="https://www.domain.com', 'data-href="http://www.domain.com', $html); 
        return $html; 
    }
    add_filter("rsssl_fixer_output","rsssl_recover_shares");

    Hi Stefan & Mark,

    Shareaholic also offers automated tools to recover your share counts when making changes to your URL structure (moving to HTTPS or otherwise).

    If you’re wondering just how many shares are at risk, take a look here to see exactly what’s on the line for you.

    Feel free to reach out me: czevin[@]shareaholic[.]com with any questions.

    Best,
    Craig

    thanks @markwolters for the input. I just realized, however, that I have the free version of the ssl plugin that you guys do – I didn’t buy the paid version, I’m trying to see if it works out with the free version first.

    So I put in the code you told me, refreshed a few times, and nothing happened. I basically lost thousands of shares in the counter on the site. It’s really sad 🙁

    RE: @czevinshareaholic – I use shareaholic and love it, but at least for now I would like NOT to pay anything for this… – is there any way you guys would “update the shares” from the system for a very loyal customer, who has been with you for >5 years? Pretty please?!?

    Plugin Contributor Mark

    (@markwolters)

    Hi Stefan,

    the og:url is still https://. Perhaps you need to clear all caches your website uses before the og:url is updated to http:// in the page source.

    Mark

    Hi @markwolters, I tried it, updated and emptied cache…but I still don’t have my shares back.

    Just to back up a little, my problem is that recently I switched to https, and since I switched, the shares counter (via shareaholic and addthis) are all 0 for everything. So basically I need to somehow add the previous shares to the current ones, and display them on the site – yet without paying one of these services, if possible…

    Does that make sense?

    Thanks again for taking your time to help.
    Stefan

    Plugin Contributor Mark

    (@markwolters)

    Hi Stefan,

    the og:url of your site still seems to be https://. Are you sure you placed the following code in your theme’s functions.php file? (replace yourdomain.com with your domain):

    function rsssl_recover_shares($html) {
        //replace the https url back to http
        $html = str_replace('og:url="https://www.domain.com', 'og:url="http://www.domain.com', $html);
        $html = str_replace('data-href="https://www.domain.com', 'data-href="http://www.domain.com', $html); 
        return $html; 
    }
    add_filter("rsssl_fixer_output","rsssl_recover_shares");
    Plugin Contributor Mark

    (@markwolters)

    Hi,

    it seems the og:url of your site is https://. To fix this, the og:url can be excluded from the mixed content fixer. How to do that is described in this article: https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/. Let me know if this resolved your issue.

    Mark

    Plugin Contributor Mark

    (@markwolters)

    Is the Really Simple SSL plugin active on the site? I cannot see the ‘data-rsssl=1’ marker in the page source. The plugin needs to be active before it can replace the og:url. If the plugin is active, you can try to enable the ‘switch mixed content fixer hook’ option, that will fire the mixed content fixer on a different WordPress hook.

    Mark

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Social Shares Count Recover After Moving to Https’ is closed to new replies.