We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22829 ☆ A M B ☆
    • 80 Posts
    Before 2.2, it was possible to access a front end doc in Revo with something like this (where 123 is the resource ID):

    site.com/123

    That "feature" appears to be gone in 2.2. Only friendly URLs and index?id=123 work now. Anyone have a good idea on how I can get that old feature back? Or am I missing something? [ed. note: paulmerchant last edited this post 14 years, 7 months ago.]
      Time is what keeps everything from happening all at once.
      • 3749
      • 24,544 Posts
      Is there some reason you don't want to use this?

      [[~123]]


      If you're doing it in code, you can use this:


      $url = $modx->makeUrl(123, "", "", "full");


      ---------------------------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
      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
        • 22829 ☆ A M B ☆
        • 80 Posts
        Thanks for the reply, Bob. (And for the book. I just got my copy and it's very well written.)

        These ID URLs have been used to link to pages from outside the site. For example, those ID URLs are really nice in print. We also have student support pages that are referred to with those ID URLs from within LMS systems, etc., but now they don't work. I'm going to need to put that functionality back in (with a plugin) unless there's something I'm missing.

        I'm also wondering why that undocumented feature existed and why it went away.

        Edit: I forgot to say that besides being an elegant way to refer to a page in print materials, we have staff that use those numbers to send people to pages when talking with someone on the phone. It's easier to say "Type oursite.com/1234 in your address bar" than it is to navigate someone through hundreds of pages or to type in the friendly URL of a page that's nested a few levels deep. Again, this has been a great undocumented feature that I need to bring back. [ed. note: paulmerchant last edited this post 14 years, 7 months ago.]
          Time is what keeps everything from happening all at once.
          • 3749
          • 24,544 Posts
          I think that only happened if you had friendly URLs on but the resources had no alias -- I could be wrong.

          Unfortunately, newer versions of Revo require an alias for all docs.

          You could use the id as the alias and have no suffix for that content type -- that might be the cleanest solution, or you could use the new Uri and Freeze Uri fields to set that as the doc's URL.

          You could also use a plugin, or a rewrite rule in .htaccess. I think this might do it (if you have no other URLs that end in numbers):

          RewriteRule /([0-9]+)$ /index.php?id=$1 [r=301]


            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
            • 32316
            • 387 Posts
            Edit: Note to self - reload posts before replying - BobRay has already responded, and in more detail!
            would it not be possible to create a rewrite rule in your .htaccess file to achieve this? [ed. note: whistlemaker last edited this post 14 years, 7 months ago.]
              • 22829 ☆ A M B ☆
              • 80 Posts
              I'm not going to be changing all the friendly URLs to IDs. Those friendly URLs are obviously important for their own reasons. Using the ID was just an added benefit on top of the friendly URLs.

              I've already been working out a plugin. (I'm also thinking I should check the code changes and see why site.com/123 used to work.)

              The rewrite rule is close. I'd have to fix it to work with some of the URLs that actually do end in numbers. Maybe I'll use a rewrite rule as a quick and dirty fix while I put this functionality back in.

              Edit: By the way, this undocumented feature has been with Revo for quite some time and it worked with friendly URLs and with pages with aliases and even when friendly URLs weren't needed. All you needed was to use the ID as the URL. I noticed it one day and put the undocumented feature to work. [ed. note: paulmerchant last edited this post 14 years, 7 months ago.]
                Time is what keeps everything from happening all at once.
                • 22829 ☆ A M B ☆
                • 80 Posts
                Thanks for pointing me towards using a rewrite rule in htaccess. The only small advantage to a plugin would be the ability to check for an existing alias or something. I don't think that's needed.

                This seems to work, placed right before the conditions and rules for friendly names:

                RewriteCond %{REQUEST_FILENAME} \d+
                RewriteRule ^(.*)$ index.php?id=$1 [R=301,L]


                If anyone has thoughts on something that would be better, let me know. [ed. note: paulmerchant last edited this post 14 years, 7 months ago.]
                  Time is what keeps everything from happening all at once.
                  • 3749
                  • 24,544 Posts
                  That looks like a good solution, depending on the placement. The L parameter will cancel any rewrite rules below it.


                  ---------------------------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                  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
                    • 8109
                    • 128 Posts
                    Yes, this is a most unfortunate change! I liked the old way, and it made sense in light of the way that friendly urls were written: any resource without an alias had its ID placed in the url.
                      Revo 2.0.8-pl