WordPress is changing all my URLs from:




For example:

<link rel="canonical" href="//www.example.com/"/>

I don't want this to happen, because it has some side effects with CDN rewriting, and my site is https only.

What is the best way to disable this "feature"?

  • To me this sounds like a bug in some plugin. Try to disable all plugins and/or change the theme and see if that behavior is gone. Then re-activate plugin after plugin and check when the behavior is back… Feb 28, 2016 at 13:05

1 Answer 1


It was caused by CloudFlare https (which doesn't set the $_SERVER['HTTPS'] variable), I solved it by forcing:

$_SERVER['HTTPS'] = 'on';

in the webserver configuration. After doing so I could also disable the CloudFlare Flexible SSL plugin, and get a little performance gain.

  • 2
    Since you were able to answer your own question, please click the green checkmark to indicate that this is resolved for record's sake. Thanks Aug 23, 2016 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.