Switching website from http to https

+1 for nuan88’s answer, http/https is the protocol and is not technically part of the domain name.

Using https should actually improve your link juice because Google (and I think some other engines) give higher scores to https sites.

All your internal links should be in the form of link tags:

<a href="[[~12]]">LinkText</a>

Where 12 is the ID of the resource you’re linking to.

If the server_protocol System Setting is set to https, MODX should automatically create https links for those tags.

I had the same problem - not in my site, just a new page - ‘insisting’ on http.

Fortunately I noticed in another browser it was fine, so I closed and reopened my main browser (Opera) and all was fine: back to https.

1 Like

Yes you have to move extremely slowly when doing this, and test a lot before changing, lots of weird backsliding and sudden, new errors (not real errors just some call can’t connect or whatever)

In general it’s really quite simple to switch to HTTPS, and MODX will automatically pick up on the change.

Caches and hardcoded values really are the only things that can get in the way.

Yes its simple, but you wouldn’t believe the number of times everything looked ok…and then the next day it was broken. Not really broken but not the right icon in the browser.

So I just mean slow down and test it like crazy before you make changes.

tried that, but still no luck :frowning:

I’m managing the following website: https://scsynergy.com

You can check the source code (header part of it) there I inserted the code to inspect what it generates and commented it out. See it attached.

the issue only lays here <base href="[[!++site_url]]" /> it simply does not set the protocol to https
all the internal links between pages are correctly set and work as expected.

but that’s not a solution :frowning:

did you search for a system-setting or context-setting with the key ‘site_url’?

there is no system setting called “site_url”,
there is “server_protocol” instead, which is set to “https”

maybe a plugin, which does that?
which plugins do you have installed and active?

did you also check context-settings?

Is your server behind a reverse proxy that adds the SSL certificate while the origin server uses HTTP rather than HTTPS? Something like Cloudflare?

How about the system setting: link_tag_scheme

For https this should be set to 1

For details see this article: https://docs.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.makeurl

Source: https://www.markhamstra.com/modx/2012/07/3-tips-for-serving-a-modx-site-over-ssl/

you are trying to use the .htaccess-file on a nginx-server?

Kindly tell me did you please search for the system-setting or contextual-setting with the key punk ‘site_url’?

I remember having similar situation and it seemed that MODX was confusing between http/https urls across website. That setup was load balanced/failover. To fix the issue I had to stop MODX figuring out http/https automatically.

To do that, I did the following:

in core/config.inc.php find:

$url_scheme=  $isSecureRequest ? 'http://' : 'https://';

replace it with:

$url_scheme = 'https://';

Hope this will help you.

I believe, this is something you need to remember during upgrades as well.

1 Like

I had the same problem - not in my site, just a new page - ‘insisting’ on http..

This happened to me as well on Modx cloud… after emptying the cache it went to https.