C
C
Cheizer2018-11-28 14:01:25
CMS
Cheizer, 2018-11-28 14:01:25

How to make different domains for contexts in MODX REVO?

Friends, how to make multisite on MODX REVO using contexts is understandable, but within the ONE domain, but is it possible to do the same but on different domains within the same site?
For example, there is a site1 context and its content is shown by the site.ru domain.
And another side2 context and its content is shown by the site2.ru domain.
That doesn’t work, everything leads to the default domain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Tarasov, 2018-12-04
@an-tar

The idea there is exactly the same, modex by and large does not care whether it is transferred to a subdomain or a domain. Is a plugin for redirecting to the desired domain used? Needed. Look, there is actually a lot of information on this subject: I googled

<?php
/* don't execute if in the Manager */
if ($modx->context->get('key') == 'mgr') {
        return;
}
 
switch (strtolower(MODX_HTTP_HOST)) {
        case 'domain2.tld':
                // if the http_host is of a specific domain, switch the context
                $modx->switchContext('domain2.tld');
                break;
        case 'domain3.tld':
                // if the http_host is of a specific domain, switch the context
                $modx->switchContext('domain3.tld');
                break;
        default:
                // by default, don't do anything
                break;
}
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question