We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32025
    • 305 Posts
    I have friendly URLs installed and working on many sites. However with my current site I notice the URL string has a number for the primary directory instead of page name.

    For instance I have a page called services and then under this page I have multiple service pages. Like: landscape, waterscape, etc.

    So I would like my URL's to look like this:
    MyDomain.com/services/
    MyDomain.com/services/landscapes.html
    MyDomain.com/services/waterscape.html

    Instead my URL's have a number (which is the resource ID) instead of the word "services". Like this:
    MyDomain.com/services/
    MyDomain.com/3/landscapes.html
    MyDomain.com/3/watercape.html

    I don't know which setting in my control panel or .htaccess controls this. Here is my .htaccess file:
    RewriteEngine On
    RewriteBase /
    
    
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    This is the first time I have seen this issue so maybe it has to do with a default setting in MODx Revo 2.2.11-pl. Know how I can change the resource ID number to the name of the directory itself?
      Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
      • 3749
      • 24,544 Posts
      That should happen automatically if you have an .htaccess (not ht.access) file and have the Use Friendly URLs System Setting on.

      Edit one of the problem pages. Make a trivial edit and save the page (after making sure it has an alias). See if that fixes it.
        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
        • 32025
        • 305 Posts
        Quote from: BobRay at Mar 04, 2014, 10:37 AM
        Edit one of the problem pages. Make a trivial edit and save the page (after making sure it has an alias). See if that fixes it.

        Yes that fixed the issue. Most of the time I do add the alias that matches the page name, but this time I did not because I notice many times it just adds automatically. This is certainly good to know up front as it will save me a little time in the future. Point in case: Just add the alias when I name the page.

        Always bailing me out Bob Ray smiley Thank you once again.
          Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
          • 3749
          • 24,544 Posts
          Check the automatic_alias System Setting. That determines whether one is created automatically.

          Another possible issue is the uri field. Resources created a while ago won't have this filled in until they're saved again.

          If you turn on automatic_alias, I think this utility snippet would fix them all:


          $docs = $modx->getCollection('modResource');
          foreach($docs as $doc) {
             $doc->save();
          }
          
            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