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

    Can anyone tell me if I can make friendly URL’s without dealing with mod rewrite or the htaccess file? I’ve been unsuccessful at making them so far using a great tutorial (http://wiki.modxcms.com/index.php/Friendly_URLs_Guide) on the MODx Wiki site and am trying to pinpoint if there is something I’m doing wrong, or if I have to edit files outside of MODx.

    Thanks in advance for any feedback, and if there are any threads on this subject that have already been discussed in this forum - please feel free to point me in the right direction!

    msflux.
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: msflux at Sep 16, 2007, 06:04 PM
      Can anyone tell me if I can make friendly URL’s without dealing with mod rewrite or the htaccess file? I’ve been unsuccessful at making them so far using a great tutorial (http://wiki.modxcms.com/index.php/Friendly_URLs_Guide) on the MODx Wiki site and am trying to pinpoint if there is something I’m doing wrong, or if I have to edit files outside of MODx.
      It’s not clear what problem you are having from your post, but the answer is not really. Though as indicated in the guide, you can get "SEO-friendlier" urls by using friendly alias urls without mod_rewrite/.htaccess. So instead of
      domain.tld/index.php?id=123

      you could have
      domain.tld/index.php?q=prefix-alias-suffix

      But to have true Friendly URLs, you must have the mod_rewrite engine (or an equivalent mechanism outside of MODx) available to silently redirect requests to URLs like
      domain.tld/prefix-alias-suffix

      to the actual URL MODx needs to respond to the request
      domain.tld/index.php?q=prefix-alias-suffix
        • 20508
        • 157 Posts
        Thank you for the reply. It appears that my friendly URL’s are working, but they are not showing up in the URL (the address bar in Web browser) by default. For example these two URL’s are the same page:

        http://mydomain.com/index.php?q=contact-us
        http://mydomain/index.php?id=8

        However by default the unfriendly URL is being shown in the address bar in the Web browser. If I type in the friendly URL, it goes to the correct page and shows the friendly URL in the address bar in the browser, but only if I manually type it in.

        Does that make sense? I assume I’m missing a little piece of information to make the URL’s show correctly. This is my first MODx site, so thanks in advance for any feedback.

        Thanks,
        msflux.
          • 22303 MODX Staff
          • 10,725 Posts
          If you are generating the links to your documents using the standard methods, i.e. [~documentId~] or $modx->makeUrl($documentId), then it should be generating the correct friendly URL links into your documents. Make sure if you have cached pages that you clear the cache after changing the settings.
            • 20508
            • 157 Posts
            Thanks again for your feedback. I realized this was totally my bad - my links are currently hardcoded (haven’t tackled Wayfinder yet) and they were pointing to the wrong URL’s. Having a "duh" moment, apologies!

            Cheers,
            msflux.