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

    Sorry but I’m not sure how to help you at this point. I have a very limited knowledge of MODx but also had FURLS problems initially. In your shoes, I would disable the FURL’s to keep the site functional and then try a new instalation of MODx on the same server with the sample data and see if the problem exists there and if so, solve it there without screwing up your real site in the process.

    ..Paul
      Visit MODx.mobi to read these forums on mobile devices.
      • 727
      • 502 Posts
      Hi Paul,

      Thanks for the help. I turned friendly URLs on on my development server and it doesn’t work there either. I’ll keep digging.

      Andy
        • 727
        • 502 Posts
        I believe I have solved the problem. Never use the following in a snippet otherwise it will break friendly URLs:

        $id = $modx->getDocumentIdentifier('id');
        


        Instead use:

        $id = $modx->documentObject['id'];
        


        Andy
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          $modx->documentIdentifier works just fine without the arguments, since it is a property, not a function.

          The function which sets it is getDocumentIdentifier($method). It is strictly an internal function, and should not be used. The $method is either "alias" or "ID", which is determined at parse time by the getDocumentMethod function. it’s based on the URL query string; if it’s "q=xx" then it’s using alias, if it’s "id=xx" then it’s using ID. Then you get all tangled up in using friendly aliases, .htaccess files and the like. Just remember that you want the property, not the function.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 727
            • 502 Posts
            When I wrote that line I couldn’t find any documentation on how to get the current document id in a snippet. So I trawled through the document parser looking for something suitable without being aware of the implications. This then broke friendly URLs in a way that I didn’t make the connection for a long time.

            If there was a wiki or something I could spend the next couple of minutes adding this to the friendly URL page to help avoid anyone else falling into the trap. smiley

            Andy
              • 33639
              • 19 Posts
              hey folks,
              i managed to get friendly urls working. the links are set using dynamic id’s and they go to the pages fine.

              RewriteEngine On
              
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              
              RewriteRule ^(.*) /path/to/index.php?q=$1 [L,R=301,QSA]


              except once the page loads. i will get the entire statement of index.php?q=page.html

              i’ve tried messing with how the rule displays but it only generates errors.

              any suggestions?
                • 16312
                • 3 Posts
                I’d take out the R=301 if you don’t want to see the rewritten URL.

                I had a little different problem caused by using Apache 1.3(.31) under Win32. I had capital letters in the friendly URLs which Apache went and forced to lowercase. I finally got it worked out by adding a third rewrite condition:
                RewriteCond %{REQUEST_URI} ^/[^/]*(.*)$

                then changing the rewrite rule to:
                RewriteRule ^(.*)$ index.php?q=%1 [L,QSA]

                The condition assumes that MODx is installed in a subdirectory. The backreference to the condition provides the proper case for the alias. I don’t know if this behavior still exists in newer Apache versions.

                Erik
                  • 13003
                  • 18 Posts
                  just to toss in my .02, Friendly URLs work fine for me under Apache 1.3/Linux

                  Just a note, when I enabled the AliasPath, any pages that were located under a virtual "folder" lost all CSS formatting. to fix this issue, I just had to edit the template and move the
                  <base href="[(site_url)]" />
                  bit above any CSS & Script calls. The base href is set too far down in the template by default, so links to CSS & Script files break.
                    • 25663 MODX Staff
                    • 12,272 Posts
                    You’re exactly correct intel352. Thanks for pointing this out; fixed for the new demo content for the next release. smiley
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 13003
                      • 18 Posts
                      haha, you’re fast rthrash smiley i also posted a bug report lipsrsealed might wanna close that now ;-)

                      thanks

                      This discussion is closed to further replies. Keep calm and carry on.