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

    Whenever I call [[!++site_url]] or $modx->getOption('site_url') all I get is '/' (without the quotes).

    According to the thread below, it should return the full website url.
    https://forums.modx.com/thread/31534/revolution-solved-quick-question-standard-way-to-retrieve-the-base-url

    I am using Revo and furl. Here is the furl content of the .htaccess file:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(fr|de|es)?(\/)?(.*)$ index.php?c=$1&q=$3 [L,QSA]
    php_value display_errors 1


    This is also set in the head of each page:
    <base href="[[!++site_url]]" />
    but the final value is this:
    <base href="/" />


    I have checked under system settings and I couldn't find this setting, so I created it with the correct value, but [[!++site_url]] still only returns '/'.

    What could be wrong here? I have been working on this for hours now.

    One other thing I noted is the following code will not return the correct value either:
    $modx->makeUrl($id,'','','full');


    David

    This question has been answered by macroman. See the first response.

    [ed. note: macroman last edited this post 14 years, 7 months ago.]
      • 1778
      • 659 Posts
      Hello

      Make sure RewriteBase points to the directory where you installed MODX.
      # E.g., "/modx" if your installation is in a "modx" subdirectory. (RewriteBase /modx)
      Cheers
        • 38982
        • 13 Posts
        Thanks anso, but if I set RewriteBase to my directory which is '/var/www/modx.revolution' then the apache server returns '500: Internal Server Error'.

        Is there anything else I can try?
          • 38982
          • 13 Posts
          Update:
          OK, all the modx files are in the base of the web directory, so RewriteBase is supposed to be '/'.
          I've checked the other settings like http_host and url_scheme and they're fine.
          I notice that site_url is defined like so in the config:
          $site_url= $url_scheme . $http_host . MODX_BASE_URL;
              define('MODX_SITE_URL', $site_url);

          I've tried hardcoding the url like this:
          define('MODX_SITE_URL', 'http://192.168.2.82:49494/');
          (ignore the '<a href' bit in the code above, this forum adds that in.) but site_url is still '/'. It seems as if this is being overwritten somewhere down the line. Not sure why though,

          David
            • 38982
            • 13 Posts
            Bump. I still haven't got any closer to solving this.

            How is it that even when I create a system setting called site_url and populate it with my web address, I still only get a relative path of '/'?

            What part of the core can I look at to try and see why this doesn't work?

            Really, really desperate to get this fixed as I don't want to go and start hacking the core apart to make a work around.

            David
            • discuss.answer
              • 38982
              • 13 Posts
              OK. The problem was there was a setting of 'site_url' in a context that was created for the babel multi-lingual addon. It was set to '/', hence the result I was getting. Removing this setting solved my problem.