We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6705
    • 79 Posts
    I have a dynamic page which does most of its work via a snippet.

    I’d like to be able to customise the output that the page generates by the use of a parameter in the URL used to call the page (only one parameter will be necessary, not any further complexity).

    Normal query parameters take the form:

    http://mysite.dom/mypage?thing=thing1


    and I can then use the value of ’thing’ (eg, ’thing1’) in my code; but for neatness’ sake, I’d prefer it if could pass my parameter as a ’slashed’ value, after the main part of the URL, eg:

    http://mysite.dom/mypage/thing1


    and then (..handwaves) magically acquire the ’thing1’ value in my snippet.

    I suppose the URL form

    http://mysite.dom/mypage/thing/1


    would also be acceptable, if it were also necessary to pass the parameter name as well as its value.


    Does anybody know if it would be easy to do this in MODx? I suspect I would find (unless somebody’s conquered this already) that I would have to write all kinds of Apache rewrite rules by myself (always an "interesting challenge") to map the ’slashed’ URLs back to a ’canonical’ query string form, and even then I suppose there is a risk that these rules might clash with the rules that MODx itself uses for Friendly URLs, etc.

      Please don't PM me unless it's absolutely essential: if a technical question is worth asking, it's worth asking in public, so that others can share their experience, and so that all can learn from the answers.