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

    The links on my MODX Evolution 1.0.10 site are not resolving correctly. This is inconsistent. They work on some pages but not on others. I'm using the following syntax <a href="[~ID~]">

    Here is an example of a page where the link (Seven Easy Pieces link in the last paragraph) is always working
    http://www.ago.net/marina-abramovic-and-ulay-rest-energy

    A page where the link "Weston Family Learning Centre" in the first paragraph is not working
    http://www.ago.net/hands-on-centre/

    And the links in the chart on this one are randomly working on and off
    http://www.ago.net/courses-workshops/

    All use the same syntax above. I'm not sure exactly how long this problem has existed but at least a couple of day. We upgraded to the recent version 1.0.10 from 1.0.9 last week. Any ideas what could be causing this random issue?

    Many thanks,
    Cristina
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      All links in the chart seem to be generated just fine.

      When clicking the link you pointed out as broken on http://www.ago.net/hands-on-centre/ it shows a page not found error for http://www.ago.net/hands-on-centre/weston-family-learning-centre/. Is that page perhaps unpublished (it will show up in italics in the tree if so), or protected by permissions?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 43589
        • 8 Posts
        Hi Mark,

        Thanks for your reply. The broken link on http://www.ago.net/hands-on-centre/ is not due to an unpublished page. If you mouse over it you will see that the url is http://www.ago.net/hands-on-centre/weston-family-learning-centre/ but it should be http://www.ago.net/weston-family-learning-centre/. In some cases the alias is being appended to the end of the current alias which causes the page not found error. Changing it to <a href="/[~ID~]"> fixes it however in the case of this page http://www.ago.net/marina-abramovic-and-ulay-rest-energy, the specified link uses the <a href="[~ID~]"> syntax and it is resolving properly to the root of the site and is not broken.
        The chart page is very odd in that it seems to alternate between working and not working. At the moment, all the links in the chart are not working for me. I had someone outside the office test yesterday and they were also broken for him.

        Here is the code in the config.inc.php
        // automatically assign base_path and base_url
        if(empty($base_path)||empty($base_url)||$_REQUEST['base_path']||$_REQUEST['base_url']) {
        $sapi= 'undefined';
        if (!strstr($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) && ($sapi= @ php_sapi_name()) == 'cgi') {
        $script_name= $_SERVER['PHP_SELF'];
        } else {
        $script_name= $_SERVER['SCRIPT_NAME'];
        }
        $a= explode("/manager", str_replace("\\", "/", dirname($script_name)));
        if (count($a) > 1)
        array_pop($a);
        $url= implode("manager", $a);
        reset($a);
        $a= explode("manager", str_replace("\\", "/", dirname(__FILE__)));
        if (count($a) > 1)
        array_pop($a);
        $pth= implode("manager", $a);
        unset ($a);
        $base_url= $url . (substr($url, -1) != "/" ? "/" : "");
        $base_path= $pth . (substr($pth, -1) != "/" && substr($pth, -1) != "\\" ? "/" : "");
        }
        // assign site_url
        $site_url= ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? 'https://' : 'http://';
        $site_url .= $_SERVER['HTTP_HOST'];
        if ($_SERVER['SERVER_PORT'] != 80)
        $site_url= str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); // remove port from HTTP_HOST  
        $site_url .= ($_SERVER['SERVER_PORT'] == 80 || (isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? '' : ':' . $_SERVER['SERVER_PORT'];
        $site_url .= $base_url;

        Any help you could provide is much appreciated.

        Cristina
          • 43589
          • 8 Posts
          Quote from: cmdias at May 02, 2013, 08:51 AM
          Hi Mark,

          Thanks for your reply. The broken link on http://www.ago.net/hands-on-centre/ is not due to an unpublished page. If you mouse over it you will see that the url is http://www.ago.net/hands-on-centre/weston-family-learning-centre/ but it should be http://www.ago.net/weston-family-learning-centre/. In some cases the alias is being appended to the end of the current alias which causes the page not found error. Changing it to <a href="/[~ID~]"> fixes it however in the case of this page http://www.ago.net/marina-abramovic-and-ulay-rest-energy, the specified link uses the </a><a href="[~ID~]"> syntax and it is resolving properly to the root of the site and is not broken.
          The chart page is very odd in that it seems to alternate between working and not working. At the moment, all the links in the chart are not working for me. I had someone outside the office test yesterday and they were also broken for him.

          Here is the code in the config.inc.php
          // automatically assign base_path and base_url
          if(empty($base_path)||empty($base_url)||$_REQUEST['base_path']||$_REQUEST['base_url']) {
          $sapi= 'undefined';
          if (!strstr($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) && ($sapi= @ php_sapi_name()) == 'cgi') {
          $script_name= $_SERVER['PHP_SELF'];
          } else {
          $script_name= $_SERVER['SCRIPT_NAME'];
          }
          $a= explode("/manager", str_replace("\\", "/", dirname($script_name)));
          if (count($a) > 1)
          array_pop($a);
          $url= implode("manager", $a);
          reset($a);
          $a= explode("manager", str_replace("\\", "/", dirname(__FILE__)));
          if (count($a) > 1)
          array_pop($a);
          $pth= implode("manager", $a);
          unset ($a);
          $base_url= $url . (substr($url, -1) != "/" ? "/" : "");
          $base_path= $pth . (substr($pth, -1) != "/" && substr($pth, -1) != "\\" ? "/" : "");
          }
          // assign site_url
          $site_url= ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? 'https://' : 'http://';
          $site_url .= $_SERVER['HTTP_HOST'];
          if ($_SERVER['SERVER_PORT'] != 80)
          $site_url= str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); // remove port from HTTP_HOST
          $site_url .= ($_SERVER['SERVER_PORT'] == 80 || (isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? '' : ':' . $_SERVER['SERVER_PORT'];
          $site_url .= $base_url;

          Any help you could provide is much appreciated.

          Cristina</a>

          One other thought: I noticed permission on the file /manager/includes are set to -rw-------. Is this correct?
            • 43589
            • 8 Posts
            Quote from: cmdias at May 02, 2013, 09:09 AM
            Quote from: cmdias at May 02, 2013, 08:51 AM
            Hi Mark,

            Thanks for your reply. The broken link on http://www.ago.net/hands-on-centre/ is not due to an unpublished page. If you mouse over it you will see that the url is http://www.ago.net/hands-on-centre/weston-family-learning-centre/ but it should be http://www.ago.net/weston-family-learning-centre/. In some cases the alias is being appended to the end of the current alias which causes the page not found error. Changing it to <a href="/[~ID~]"> fixes it however in the case of this page http://www.ago.net/marina-abramovic-and-ulay-rest-energy, the specified link uses the </a><a href="[~ID~]"> syntax and it is resolving properly to the root of the site and is not broken.
            The chart page is very odd in that it seems to alternate between working and not working. At the moment, all the links in the chart are not working for me. I had someone outside the office test yesterday and they were also broken for him.

            Here is the code in the config.inc.php
            // automatically assign base_path and base_url
            if(empty($base_path)||empty($base_url)||$_REQUEST['base_path']||$_REQUEST['base_url']) {
            $sapi= 'undefined';
            if (!strstr($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) && ($sapi= @ php_sapi_name()) == 'cgi') {
            $script_name= $_SERVER['PHP_SELF'];
            } else {
            $script_name= $_SERVER['SCRIPT_NAME'];
            }
            $a= explode("/manager", str_replace("\\", "/", dirname($script_name)));
            if (count($a) > 1)
            array_pop($a);
            $url= implode("manager", $a);
            reset($a);
            $a= explode("manager", str_replace("\\", "/", dirname(__FILE__)));
            if (count($a) > 1)
            array_pop($a);
            $pth= implode("manager", $a);
            unset ($a);
            $base_url= $url . (substr($url, -1) != "/" ? "/" : "");
            $base_path= $pth . (substr($pth, -1) != "/" && substr($pth, -1) != "\\" ? "/" : "");
            }
            // assign site_url
            $site_url= ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? 'https://' : 'http://';
            $site_url .= $_SERVER['HTTP_HOST'];
            if ($_SERVER['SERVER_PORT'] != 80)
            $site_url= str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); // remove port from HTTP_HOST
            $site_url .= ($_SERVER['SERVER_PORT'] == 80 || (isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? '' : ':' . $_SERVER['SERVER_PORT'];
            $site_url .= $base_url;

            Any help you could provide is much appreciated.

            Cristina</a>

            One other thought: I noticed permission on the file /manager/includes/config.inc.php are set to -rw-------. Is this correct?
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              Ah.

              You need to add this to your <head> when you use alias paths (ie multiple /levels/in/the/url with friendly urls):

              <base href="[(site_url)]" />/code]
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 43589
                • 8 Posts
                Quote from: markh at May 02, 2013, 03:54 PM
                Ah.

                You need to add this to your when you use alias paths (ie multiple /levels/in/the/url with friendly urls):

                <base href="[(site_url)]">/code][/quote]
                
                Thanks Mark. I actually found this solution yesterday and forgot to reply to the post. We were not using this in the past. Did something change in the latest version that now requires the use of base href?
                
                Thanks,
                Cristina
                  • 18373 ☆ A M B ☆
                  • 3,141 Posts
                  Base href has been a requirement for a long time, but only if you use alias paths (some/resource/here.html). Revolution lets you change the default_tag_scheme setting to "abs" in which case it's not required anymore, but Evo doesn't have this.
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 43589
                    • 8 Posts
                    Quote from: markh at May 06, 2013, 07:41 AM
                    Base href has been a requirement for a long time, but only if you use alias paths (some/resource/here.html). Revolution lets you change the default_tag_scheme setting to "abs" in which case it's not required anymore, but Evo doesn't have this.

                    This is odd. Our site has been working for years without the base href code in the header. We use alias urls at the root (i.e., http://www.ago.net/exhibitions, http://www.ago.net/collections) and we don't have published html pages - all the pages are built from the database.
                      • 18373 ☆ A M B ☆
                      • 3,141 Posts
                      If your url structure is only one level (only /exhibitions and not /exhibitions/foo) you wont need it.
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.