Title: Canonical Sitewide https or http Option
Last modified: August 30, 2016

---

# Canonical Sitewide https or http Option

 *  Resolved [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/)
 * 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:(.
 * Thanks,
    Michael Shinosky
 * [https://wordpress.org/plugins/wordpress-seo/](https://wordpress.org/plugins/wordpress-seo/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/page/2/?output_format=md)

 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249265)
 * 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?
 * Thanks,
    Michael Shinosky
 *  [darrencss](https://wordpress.org/support/users/darrencss/)
 * (@darrencss)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249267)
 * In main site settings are the WordPress Address URL and Site Address URL set 
   to https: ?
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249268)
 * 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.
 *  [zionsrogue](https://wordpress.org/support/users/zionsrogue/)
 * (@zionsrogue)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249282)
 * 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.
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249283)
 * 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.
 *  [zionsrogue](https://wordpress.org/support/users/zionsrogue/)
 * (@zionsrogue)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249284)
 * Thanks Michael!
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249285)
 * 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.
 *  [zionsrogue](https://wordpress.org/support/users/zionsrogue/)
 * (@zionsrogue)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249286)
 * What’s really interesting is that it should be possible to override the [rel_canonical](https://developer.wordpress.org/reference/functions/rel_canonical/)
   function of WordPress to replace the `https` with `http`
 * However, as [this post](https://wordpress.org/support/topic/canonical-link-and-wpml?replies=1)
   and [this one](https://wordpress.org/support/topic/wordpress-seo-plugin-by-yaost-cant-remove-canonical-links?replies=1)
   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](http://wordpress.stackexchange.com/questions/112524/force-http-canonical-tag-on-https-pages)
   to achieve the desired functionality, I just can’t figure out how override the
   other functions.
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249288)
 * Yeah – really don’t know what is going on. I tried getting into the plugin code
   and doing some modifying with no success.
 *  [zionsrogue](https://wordpress.org/support/users/zionsrogue/)
 * (@zionsrogue)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249297)
 * 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";`
 * To:
 * `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.
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249299)
 * Awesome – glad you got a quick hack to work :). Didn’t work for me though :(.
   Thanks for keeping me updated.
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249307)
 * 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”.
 *  [zionsrogue](https://wordpress.org/support/users/zionsrogue/)
 * (@zionsrogue)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249309)
 * 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.
 *  Thread Starter [Michael Shinosky](https://wordpress.org/support/users/michael-shinosky/)
 * (@michael-shinosky)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249313)
 * Marking this resolved
 *  [bindashsandeep](https://wordpress.org/support/users/bindashsandeep/)
 * (@bindashsandeep)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/#post-6249380)
 * [@zionsrogue](https://wordpress.org/support/users/zionsrogue/) Thanks it works
   dude 🙂 🙂

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/page/2/?output_format=md)

The topic ‘Canonical Sitewide https or http Option’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

## Tags

 * [HTTPS](https://wordpress.org/support/topic-tag/https/)

 * 16 replies
 * 5 participants
 * Last reply from: [kristarella](https://wordpress.org/support/users/kristarella/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/canonical-sitewide-https-or-http-option/page/2/#post-6249390)
 * Status: resolved