Force https for 2 domains / same site

I have a website that is served under 2 domain names:

I use the [[!++http_host]] method along with output modifiers to present slightly different content depending on which domain name is used to access the site.

How can I force https across both domains?

Please pay attention to link_tag_scheme system setting (it should have 1 value, here is reference:\modX::makeUrl()).
If you use two contexts for these two domains be sure this setting works for both of them.
The same idea for server_protocol setting, set https here

And properly linked SSL certificates for both domains of course.

it will also be useful to add a 301 redirect from http:// to https:// for your web server afterwards

Thank you. This is just one context and the server_protocol is set for https. My understanding is that the link_tag_scheme on its own won’t do this so how to force to https (via .htaccess?) no matter which of the domains is visited?

Try this:

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
1 Like

Absolutely spot on Bob - thank you

I’m glad it worked for you. :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.