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

    I have some issues with the site_url on a new site (the setting picks up an alias domain (the .com version rather than the correct primary domain (.co.uk)) and it made me want to check where this is actually coming from.

    The Wiki says this:

    <base href="[(site_url)]"></base>
    This sets the base URL for other use, like locating images, etc. It gets the URL from: MODx / Access / templates / from information you entered as you set up MODx.

    Can anyone tell me where this is, the MODx/Access/templates didn’t make sense to me, and you don’t enter it during install

    Are there any nasty side effects if I just type in the correct domain manually into the template

    Thanks

    Mark
      • 22303 MODX Staff
      • 10,725 Posts
      You can hardcode it, though if someone accesses it from an alias domain then when they click the links it will go back to the one you hardcoded. If you want it to work with multiple, just use a non-cacheable snippet to return the value of site_url, e.g. in Evo:
      <?php
      return $modx->config['site_url'];
      ?>

      or using the new Revo API method:
      <?php
      return $modx->getOption('site_url', null, MODX_SITE_URL);
      ?>