Support » Plugin: Yoast SEO » Canonical Sitewide https or http Option

  • Resolved Michael Shinosky


    I thought I remembered there an option to make the canonical URL either http or https sitewide. Now I see the canonical is “//” with no http or https.

    What can I do to correct this? I need the website to be https sitewide. Google is not registering most of my product pages as https. Possible duplicates now :(.

    Michael Shinosky

Viewing 15 replies - 1 through 15 (of 16 total)
  • Am I not going to get an answer to this? All my canonical links are being displayed like this:

    <link rel=”canonical” href=”//www. mysite. com/product-category/product-here/”/>

    I need it like this: <link rel=”canonical” href=”https://www. mysite. com/product-category/product-here/”/>

    Google is not indexing my pages as https even though it’s impossible to access my site through http protocal.

    Like I said – I thought there was an option to select whether canonical links would be displayed sitewide as either https or http.

    Help please?

    Michael Shinosky

    In main site settings are the WordPress Address URL and Site Address URL set to https: ?

    Thanks darrencss,

    It appears that there is something in the database that is causing this to happen. I have https configured in general settings on another site using WordPress Seo. Canonical tag is working like it should. Im going to have to remove the plugin and reinstall it.

    Thanks again.

    Michael: I’m having the exact same issue. Unfortunately, I can’t really risk simply uninstalling the plugin and re-installing it do to a lot of SEO factors I have going on and I’m not willing to put them at jeopardy. Did you manage to solve this problem? If so, I would love to hear your solution.

    Hi zionsrogue,

    No I have not tried this approach yet. Been too busy with other tasks. Hopefully can get to it by the end of the week. I’ll keep this thread updated.


    Thanks Michael!

    I just tried to delete and reinstall the Yoast plugin. Also deleted all the settings on my dev server. Didn’t do the trick. It must be something else with some wordpress setting in the database. I might of made a mass update in the database to change http:// to // when switching over to complete https. Not sure though. I don’t have my site that deeply documented.

    What’s really interesting is that it should be possible to override the rel_canonical function of WordPress to replace the https with http

    However, as this post and this one demonstrate, you need to override the WordPress SEO canonical function, which either removes all canonical URLs or leaves the others intact.

    Technically, you could use this function to achieve the desired functionality, I just can’t figure out how override the other functions.

    Yeah – really don’t know what is going on. I tried getting into the plugin code and doing some modifying with no success.

    Hey Michael, I think I managed to create a quick hack to fix the issue.

    Open up wordpress-seo/frontend/class-frontend.php and change line 871 from:

    echo '<link rel="canonical" href="' . esc_url( $canonical, null, 'other' ) . '" />' . "\n";


    echo '<link rel="canonical" href="' . esc_url( str_replace("https://", "http://", $canonical), null, 'other' ) . '" />' . "\n";

    And that looks like it fixes the issue. However, this change will be overwritten every time the plugin is updated so I’m currently looking for a more permanent fix.

    Awesome – glad you got a quick hack to work :). Didn’t work for me though :(. Thanks for keeping me updated.

    I found the what was causing this problem for me. It was the HTTPS Protocol Rewriting option set to on in the Cloud Flare Plugin we use. I switched it to off and it corrected the issue with seemingly no adverse effects with “mixed content writing”.

    Interesting! I had a similar issue when using the W3 Total Cache plugin. There was a certain flip I had to switch, and once I flipped it, it removed the mixed content errors.

    Marking this resolved



    @zionsrogue Thanks it works dude 🙂 🙂

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Canonical Sitewide https or http Option’ is closed to new replies.