We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37582
    • 65 Posts
    Hi there,

    we are using MODX as a multidomain setup. Therefor, we use the good old gateway plugin, which basically looks like this:

    if ($modx->context->get('key') != 'mgr') {
        //grab the current domain from the http_host option
        switch ($modx->getOption('http_host')) {
            case SERVER_DE:
                $modx->switchContext('de');
                $modx->setOption('site_url', $protocol . SERVER_DE . '/');
                $modx->setOption('cultureKey', 'de');
                $modx->setOption('site_start', 6);
                $modx->setOption('error_page', 298);
                break;
            case SERVER_FR:
                $modx->switchContext('fr');
                $modx->setOption('site_url', $protocol . SERVER_FR . '/');
                $modx->setOption('cultureKey', 'fr');
                $modx->setOption('site_start', 7);
                $modx->setOption('error_page', 301);
                break;
    


    Now, we want to add tracking parameters to our root domain, say example.com/?trackingId=098098

    However, MODX will redirect to example.com/ and all tracking parameters are lost. This does not happen on subpages like example.com/sample.html?trackingId=009808.

    We supposed that it is the gateway plugin, specifially the setOption('site_start'). If MODX sees that the request URI is what is set as site_start, then it will redirect to the alias of the resource. Is that correct, and if so, is it possible to preserve any GET-Parameters?
    • It looks like this might actually be a bug with ignoring the GET parameters when the identifier is empty. Can you file a ticket in the tracker for this?
        • 37582
        • 65 Posts
        Thanks opengeek. Here's the issue: http://tracker.modx.com/issues/10268

        However, can you tell me where the issue occurs? I mean, we thought it was when switching the context. But we could not find any header redirects. Can you point me exactly to where this takes place? Is there any workaround we could use?
        • The issue is most likely in the modRequest::_cleanResourceIdentifier() method (@ line 312 in v2.2.10-pl) — https://github.com/modxcms/revolution/blob/master/core/model/modx/modrequest.class.php#L312
            • 43267
            • 5 Posts
            Since the Tracker seems to be down, I wonder if there is a fix for this issue in the meantime.

            This is very important for tracking reasons and linking to subpages only is not an option for us.

            Can someone at least explain why this occurs since it looks like a feature to me. Why is the URL cleaned up on the root?