CityHost.UA
Help and support

How to configure HTTPS for MODX

 4657
17.04.2020
article

Setting https for MODX is done according to approximately the same algorithm as for sites running on other CMSs. First, you need to buy an SSL certificate from the provider and install it in any way (by yourself or by contacting technical support). Also, be sure to make a backup copy of the site and database. In case of incorrect operation of the web resource, you can restore the latest working version, avoiding unnecessary problems. After that, you can configure the https protocol.

Switching to https for MODX has some specifics depending on the version. Therefore, there will be two instructions below: for Evolution and for Revolution.

HTTPS settings for MODX Evolution

To configure https for MODX, follow these simple steps :

  1. Go to the web resource management admin panel. By default, it opens at http://sait.ua/manager.
  2. Go to the "Tools" section and select the "Configuration" item. On the "Site" tab, specify the required server type - https. MODX Evolution
  3. Open the Templates tab. Select the desired template and change the link to the main URL of the web resource. To do this, find the line that contains the base href and edit it like this:

MODX Evolution https setting

After making the changes, select "Site" - "Clear cache" and perform the following action.

https for modx

There is a possibility that the site will have external http links that refer to third-party resources. They will have to be rewritten manually.

And the last stage is redirection settings. This is necessary so that users, when opening the old com.ua domain of the c http site, are automatically redirected to the new https URL.

Open the .htaccess file in the root directory of the web resource and write the following lines after the RewriteEngine On directive:

RewriteEngine On # if not already added

RewriteBase / # if not already added

RewriteCond% {HTTPS} off

RewriteCond% {HTTP: X-Forwarded-Proto}! Https

RewriteRule ^ (. *) $ Https://% {HTTP_HOST} % {REQUEST_URI} [L, R = 301]

This is a universal code, suitable in 90% of cases. If it doesn't work, you can configure redirection in alternative ways.

How to configure HTTPS for MODX Revolution

Converting a MODX Revolution site to HTTPS is much easier. The instruction is as follows :

  1. Go to the web resource management admin panel.
  2. Open the "Settings" section and select the "System Settings" item.
  3. Enter http in the key search.
  4. In the received results, change the server_protocol parameter. Wherever there is http, you need to replace it with https.

The link_tag_scheme parameter is similarly edited. Here it is necessary to replace the value -1 with 1.

And the last step is to configure redirection to https. The universal code indicated above is suitable here.

After the manipulations, errors sometimes occur. This happens even with advanced users who know how to configure https for MODX. These are usually mixed content errors, when certain http links are not replaced with https.

To eliminate them, find the core/config/config.inc.php file.

Then change the line : $ IsSecureRequest = false;

For this : $ IsSecureRequest = true;

And this line : $ Url_scheme = $ isSecureRequest? 'Https://': 'http://';

It should be rewritten like this : $ Url_scheme = $ isSecureRequest? 'Http://': 'https://';

Or like this : $ Url_scheme = 'https: //';

If the problem remains or other nuances arise, contact our technical support (working 24/7).


Like the article? Tell your friends about it: