Support » Plugin: WordPress SEO Plugin - Rank Math » How to fix redirects http > https

  • Resolved matrixpoland

    (@matrixpoland)


    As you can see because of 301 redirect (don’t know where it is set) to https this app shows 0 shares and likes. On http version of this share link it has about 89.

    How to change that?

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Rank Math

    (@rankmath)

    Hello @matrixpoland

    Thank you for contacting the support.

    This is not an issue related to the plugin but here are a few resources which should help you:
    https://cognitiveseo.com/blog/13431/recover-facebook-shares-https/
    and
    https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/

    Hope that helps.

    Redirects, meta tags for it and canonical links are not related to Rank Math?

    https://i.imgur.com/Wdq11Bs.png

    Where change what i marked?

    I add that i changed many options in Rank Math

    eg
    Redirect Orphan Media

    from http to https

    and others.
    ====
    From your links:

    3. Update rel=”canonical”
    
     
    
    The previous step left you with all your shares to zero. By now you might be thinking how these steps are really helping you in getting your shares back. Bear with me as you are closer and closer to getting your social shares count. 
    
     
    
    The next step in solving the social share loss situation is to alter the content you are showing to Facebook’s crawler. What you need to do, for Facebook only, is to make sure that the rel= canonical tag is placed, but not the way you would think of. It’s exactly the other way around: you need to make the http version the preferred one, just like in the example below: 
    
     
    
    <link rel="canonical" href="https://cognitiveseo.com/blog/11813/ways-of-repurposing-content/" />
    1
    	
    <link rel="canonical" href="https://cognitiveseo.com/blog/11813/ways-of-repurposing-content/" />
    
     
    
    has to be
    
     
    
    <link rel="canonical" href="http://cognitiveseo.com/blog/11813/ways-of-repurposing-content/" />
    1
    	
    <link rel="canonical" href="http://cognitiveseo.com/blog/11813/ways-of-repurposing-content/" />

    How to change canonical for all URLS?

    • This reply was modified 3 months, 4 weeks ago by  matrixpoland.
    Plugin Author Rank Math

    (@rankmath)

    Hello @matrixpoland

    You can use the following filter to modify your canonical URLs to use HTTPS:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
        $canonical = preg_replace( '/^https:/i', 'http:', $canonical );
        return $canonical;
    });

    Or the other way around. Hope that helps. Thank you.

    This is the code for functions.php?

    Plugin Author Rank Math

    (@rankmath)

    Hello @matrixpoland

    Yes, please put this code in the theme’s functions.php file after taking the backup of your site.

    Hope that helps. Thank you.

    https://developers.facebook.com/tools/debug/sharing/?q=http%3A%2F%2Fswiadomosc-zwiazkow.pl%2Fjak-kobiety-rujnuja-zwiazki-starajac-sie-dominowac-nad-mezczyznami%2F

    Circular Redirect
    We could not resolve the canonical URL because the redirect path contained a cycle.

    This warning is after copying this code to functions.php

    Sharing debugger still shows only https likes and shares. No http counts

    • This reply was modified 3 months, 2 weeks ago by  matrixpoland.
    Plugin Author Rank Math

    (@rankmath)

    Hello @matrixpoland

    The redirect is happening because Facebook follows the URL it finds in the rel="canonical" tag or in the og:url tag. Here’s a breakdown of the requests Facebook makes:
    1. It fetches the http version of the page, as instructed.
    2. Your server responds with 301 redirect to the https version.
    3. Facebook fetches the https version, where it finds the canonical tag with the http URL in it.
    4. We’re back to step 1.

    The only way to solve this issue is to remove the HTTP to HTTPS redirection on your site, however, we would advise against doing that, because it might result in duplicate content issues.

    Hope that helps.

    Actually situation is this

    https://developers.facebook.com/tools/debug/sharing/?q=http%3A%2F%2Fswiadomosc-zwiazkow.pl%2Fwybor-kobiety-zycia-raport-dla-przebudzonego-mezczyzny%2F

    Here it shows 0 likes and shares.

    The provided value for ‘og:url’ might be incorrect.
    The provided property ‘og:url’ (‘https://swiadomosc-zwiazkow.pl/wybor-kobiety-zycia-raport-dla-przebudzonego-mezczyzny/’) does not represent the input URL. You can safely ignore this message after double checking the provided value

    https://swiadomosc-zwiazkow.pl/wybor-kobiety-zycia-raport-dla-przebudzonego-mezczyzny/

    And here is 30 or 60

    Plugin Author Rank Math

    (@rankmath)

    Hello,

    The difference is possibly due to the internal cache of the sharing plugin you are using, WP Socializer. It updates the like count intermittently, and it is possible that when it fetches the count from Facebook, it ignores the response when it is “zero like”, so it may only update when your new https version gets its first like.

    We would advise contacting the author of the WP Socializer plugin about the discrepancy between the numbers.

    Hope that helps.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.