We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49407
    • 159 Posts
    Currently, when I type "mydomain.com/resource/something/24" into the address bar, modx loads resource id 1. I don't want that behavior.

    I would rather modx load "resource" so I can parse the URI and display data dynamically from the database like friendly URLs should.

    In other words, how can I tell modx to load the last URI that matches an alias and not default to resource 1 if it can't find a child resource of that resource with the very last name in the URI.

    I feel like this is probably a confusing post so I will provide an extensive example of how I want to have modx setup with friendly URLs.

    Example of the behavior I wish for...
    I have a resource with the alias "apples". This resource will either show a page of all different kinds of apples that you can click to (mydomain.com/apples), or, it will show only a specific type of apple based on the URI (mydomain.com/apples/red-delicious), dynamically, without having to create a child resource for each apple type.

    The reason I need this functionality is because I am writing a custom snippet that dynamically pulls entries from the database. I do not want to put "?something=something-else" in the address bar for SEO and it's much easier for a reader to remember that they were on "mydomain.com/apples/red-delicious" than "mydomain.com/apples?type=9", plus, I'm working with several thousand different kinds of "apples". Creating a resource for each "apple" is not an option at all.

    I have search everywhere for friendly url tutorials that explain how to set this up with .htaccess, but that's not the best way to handle it. I thought I came across a post similar to this that had a great solution but I can't for the life of me find it anywhere. I'll keep searching. In the meanwhile if anyone out there can advise me I would be greatly appreciative.

    This question has been answered by donshakespeare. See the first response.

    [ed. note: aaronkent last edited this post 11 years, 2 months ago.]
    • discuss.answer
      • 42562
      • 1,145 Posts
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 49407
        • 159 Posts
        Quote from: donshakespeare at Jul 29, 2015, 10:00 PM
        MODx Idea
        https://forums.modx.com/index.php?action=thread&thread=60038&i=1

        Non MODx
        http://webmasters.stackexchange.com/questions/23190/how-to-pass-get-parameters-to-rewritten-url

        I am sure there is an answer to your post...just around the corner

        Thanks for the reply, donshakespeare!

        It has inspired me to change the error_page in system settings to a resource with custom URI parsing utility that directs traffic so to speak, or throws an error message at the visitor.

        Talk about a derpy moment. The answer was so easy, I was over-complicating it.

        Cheers!
          • 42562
          • 1,145 Posts
          I think this is something similar that Articles does.
            TinymceWrapper: Complete back/frontend content solution.
            Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
            5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.