We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10208 ☆ A M B ☆
    • 1,780 Posts
    OK, well this is the same site that adds forward slashes to the bookmarkThis image output (solved with ../ due to directory path). I still don't get where this might be set, but maybe it's wreaking havoc on Articles now.

    The article itself displays the home page with an article url such as:

    http://domain.com/modxDirectory//2012/06/19//

    When the link to said article produced by the recent_posts snippet is clicked, an entirely different url is displayed and directs to a strange (to me) "page not found" page likely produced by the server setup at the root. Notice the extra slash at the end of the url below:

    http://domain.com/2012/06/19//

    The article container displays properly, but not the article itself.

    FURL's are activated, and working elsewhere throughout the site.

    Please, any help is appreciated. This is just silly!

    Revo 2.2.4-pl
      Frogabog- MODX Websites in Portland Oregon
      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
      Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Seems like the recent versions of MODX might be having some trouble if installed in sub-directories...
        • 10208 ☆ A M B ☆
        • 1,780 Posts
        Disabling FURL's has fixed it. Great...

        I wonder if there's anything in here I can adjust? This section is from \core\components\articles\model\articles\article.class.php

                $settings = $container->getContainerSettings();
        
                $date = $this->get('published') ? $this->get('publishedon') : $this->get('createdon');
                $year = date('Y',strtotime($date));
                $month = date('m',strtotime($date));
                $day = date('d',strtotime($date));
        
                $containerUri = $container->get('uri');
                if (empty($containerUri)) {
                    $containerUri = $container->get('alias');
                }
        
                $furlTemplate = $this->xpdo->getOption('articleUriTemplate',$settings,'%Y/%m/%d/%alias/');
                $furlTemplate = str_replace('%Y', $year, $furlTemplate);
                $furlTemplate = str_replace('%m', $month, $furlTemplate);
                $furlTemplate = str_replace('%d', $day, $furlTemplate);
                $furlTemplate = str_replace('%alias', $this->get('alias'), $furlTemplate);
        
                /** @var modContentType $contentType */
                $contentType = $this->xpdo->getObject('modContentType', '');
                if ($contentType) {
                    $extension = ltrim($contentType->getExtension(), '.');
                    $furlTemplate = str_replace('%ext', $extension, $furlTemplate);
                }
        
                $furlTemplate = str_replace('%id', $this->get('id'), $furlTemplate);
        
                $uri = rtrim($containerUri,'/') .'/'. rtrim($furlTemplate);
        
                $this->set('uri',$uri);
                $this->set('uri_override',true);
                return $this->get('uri');
            }
        
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 3749
          • 24,544 Posts
          I assume that you've checked to make sure magic_quotes_gpc is off. That's the usual culprit for extra slashes, especially like the ones you're seeing. Check phpinfo() to make sure (System -> System Information -> the little 'view' link near the top).

          In the DB, check the uri field of the articles which contains the hard-coded URL. If that has the double slashes, and freeze_uri is set (it should be), no configuration changes you make will fix it except for new Articles.

          See if the problem occurs for new Articles. It may be something that happened earlier when you were messing with the path settings. You may have fixed it already.

          While you're in the DB, see if the Articles are marked as containers or not (look at the isfolder field).
          If isfolder is set, check the container_suffix System Setting.

          Also, check the Articles URL format (Manage Articles -> Advanced -> General --near the bottom). The default is:

          %Y/%m/%d/%alias/



          If the double slashes are in the DB, this snippet should fix them. Worst case, you could run it and clear the site cache whenever there are new Articles. wink

          <?php
          /* FixSlashes snippet */
          
          $resources = $modx->getCollection('modResource', array('class_key' => 'Article'));
          
          $i = 0;
          foreach($resources as $resource) {
             $count = 0;
             $uri = $resource->get('uri');
             $uri = str_replace('//', '/', $uri, $count);
             if ($count) {
                $i++;
             }
             $resource->set('uri', $uri);
             $resource->save();
          }
          
          return 'Fixed ' . $i . ' Articles';



          If the double slashes are in the DB and snippet doesn't fix them, then it's almost certainly magic_quotes_gpc at work.



          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 10208 ☆ A M B ☆
            • 1,780 Posts
            Crap, lost another response to the backspace. It would be nice if this forum might actually remember what we type if that happens (love that feature). grrr...

            The first option you suggested worked Bob. Thanks for thinking so hard and writing all that. Hopefully someone else can find use from it.

            I turned FURL's back on, created new article and all is well. The article in question was just a test anyway. php.ini was set for magic_quotes and register_globals off right after I installed MODX. It's always the first thing I check/modify. Both were set to on incidentally.

            Thanks again, I'm back up and running...
              Frogabog- MODX Websites in Portland Oregon
              "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
              Having server issues? These guys have MODX Hosting perfected - SkyToaster
              • 3749
              • 24,544 Posts
              I'm glad you got it working. smiley


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting