Using XRouting for Multi-Domains Issue

I have a site that has multi-contexts. They are working great and as they should be. I have recently added a domain and pointed it to the modxcloud location. I setup another context and added the information needed with the http_host being that domains host. Is there anything additional I need to do? I assumed a domain would work right away, haven’t really had issues before with subdomains.

All I get is “Page Not Found”. And it’s not my 404 page I have setup on the other hosts, it’s the default standard message.

Modx 2.7.0

Results for Debug:

## MODX context map:

[_hosts] => Array
        [] => Array
                [0] => web
                [1] => en-gb
                [2] => de
                [3] => careers
        [] => Array
                [0] => rpaas

[web] => Array
        [base_url] => /
        [cultureKey] => web
        [http_host] =>
        [site_start] => 1
        [site_url] =>

[rpaas] => Array
        [base_url] => /
        [cultureKey] => rpaas
        [http_host] =>
        [site_start] => 443
        [site_url] =>

[en-gb] => Array
        [base_url] => /en-gb/
        [cultureKey] => en-gb
        [http_host] =>
        [site_start] => 14
        [site_url] =>

[de] => Array
        [base_url] => /de/
        [cultureKey] => de
        [http_host] =>
        [site_start] => 18
        [site_url] =>

[careers] => Array
        [base_url] => /careers/
        [cultureKey] => careers
        [http_host] =>
        [site_start] => 171
        [site_url] =>

## Requested URL: 
## Requested URL with base_url: /
## Matched context(s) (Array key defines match quality):
[1] => rpaas
## Request will go to context: rpaas
## Modified request URL:

Did you clear all core/cache dir contenta manually?

Sometimes persistent cache tricks us… I faced that issue.
Your setup seems correct and I am assuming resource Id 443 exists.


Yeah, cache seems to be the cause of a lot of my issues, just when you think you have it.

But yeah I have cleared cache, even reinstalled the plugin and tried ContextRouter. Surprisingly enough ContextRouter caused all my other subdomains not to work.

If that seems correct I will keep looking into it, maybe my domain is wrong, then again, I have issued an SSL cert for them and it recognized them as pointed to the right direction.

Do I need to adjust my NGINX rewrite rules in order to use an additional URL?

With xrouting you shouldn’t.

In your cloud dashboard: did you add the domain to the cloud account under the Domains tab? And since you’re using ssl, did you reissue the cert so that it covers the new domain (under Add-ons > SSL)?

Hey, thanks for replying. Yeah all the domains resolve as they should. Even ran a test page in the home directory and used the secondary domain to access it with no issues. and ALL certs work as they should.

What do you have in your nginx rules? Might be something like the redirect to https that is specific to the original domain that needs to be rewritten to include the new domain?

There is mainly an HTTPS rewrite and rewrite for canonical using only the www version mainly. Everything else is caching of images.

I have tried removing all the rules too. It will end up being something very small I just know it.

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; 
if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;

if ($host = "") {
    return 301 $scheme://$request_uri;

When I try to load that url ( I get a 403 Forbidden page. I say this only because you said you are seeing a 404 page…
Is the start page for the new context published?

This is a testing environment, I have it blocked to only my internal IP.

edit: I took the restriction off, but the site status is still offline.

Makes sense.

Anything in the page template? … Hard-coded base URL for some other domain? (Now I’m just grasping.)

Edit: Also have you submitted a ticket to MODX Cloud support? Even though it doesn’t seem like a cloud issue per se, they are just so smart and helpful.

Thank’s for trying, That’s a good suggestion. I tried using the --base href="[[!++site_url]]"-- and also made it just on a blank template.

I’m going to try and rebuild it all from scratch and see if something clicks.

I feel silly, It is the site status being down…Turned it on and all works.

1 Like

Aaaa! You did say that, and I read it and assumed you meant the start page wasn’t published. Wish I’d been paying better attention. But YAY - it’s fixed now!

Thanks for this thread. I can’t seem to get multi-sites going on MODX. I want to host a completely different URL on my installation of MODX. I have created a context, set the settings http_host, setting_ste_start and site_url. I then installed xRouting.

I also pointed my 2nd domain to the same IP as the main domain where MODX is installed.

Can anyone help as to what steps I am missing?


I think we will need some more info in order to help.
What version of MODX?
What server is your site on, Apache or Nginx?
Is it a MODX Cloud site?
Can you post screen shots of your context settings for each context?

I’m not familiar with the setting setting_ste_start . Is that really what you have or is it a typo?
The context settings I use are base_url, http_host, site_start, site_url. Do you have those set for each context including web (but NOT mgr)?