We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16789
    • 3 Posts
    For this I use the OneGateway plugin. This works if you set a domain alias on the domain.tld in Plesk.

    But for a subdomain I cannot set an alias in Plesk. Nor can I set apache options so I have to create subdomains through Plesk. I thought to use a modified index.php to switch the context.

    In the subdomain webroot I copy index.php, config.core.php and htaccess. I modify index.php as follows:

      //insert on line 53<br />  define(’MODX_CORE_PATH’, ’/var/www/vhosts/domain.tld/httpdocs/core/’);<br />  // to override define(’MODX_CORE_PATH’, dirname(__FILE__) . ’/core/’); from config.core.php<br />  // line 89:<br />  $modx->initialize(’dev’);<br />

    File structure on server:

    /var/www/vhosts/domain.tld/httpdocs (modx revo pl install)<br />/var/www/vhosts/domain.tld/subdomains/dev/htpdocs (index.php)  <br />



    This more or less works, it displays the page but all styling is missing.

    From the displayed page:
    <base href="http://dev.domain.tld/" />
    <meta name="robots" content="noindex,nofollow" />
    <link rel="stylesheet" type="text/css" href=
    "/assets/templates/mytemplate/css/style.css" />

    Obviously a path problem.
    But how to solve this?

    Greetings,
    John
      • 28215
      • 4,149 Posts
      Best thing would be to add an ’assets_url’ Context Setting to your subdomain (non-web context) and point that setting to your actual assets url where the css is on your main server, ie: http://domain.tld/assets/, and then reference it in your templates, ie:

      <link rel="stylesheet" type="text/css" href="[[++assets_url]]templates/mytemplate/css/style.css" />


      This will tell the subdomain to get the CSS from the main server.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 16789
        • 3 Posts
        That works nicely!

        Thanks for the quick reply.

        John
          • 19604 ☆ A M B ☆
          • 179 Posts
          @splittingred: Great hint, but how am I to find out for myself, that there is a setting like "assets_url" for a context? In the system settings there is no "assets_url" to be found. How can I do the magic without you all-knowing-wizzards?

          best
          olih
            MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
            http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
            • 16789
            • 3 Posts
            Assets_url did not exist in modx prior to my need smiley. This may be considered a variable for the context. It has no function but to keep the template generic, which is what I want.