We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17429
    • 18 Posts
    I would like to use alias paths in my urls, so that a tree like so:
    01
    01.01
    01.02
    01.02.01
    01.02.02
    01.03
    01.04
    01.04.01
    02
    02.01

    could be accessed via the folowing URLs:

    www.example.com/01
    www.example.com/01/01
    www.example.com/01/02
    www.example.com/01/02/01
    www.example.com/01/02/02
    www.example.com/01/03
    www.example.com/01/04
    www.example.com/01/04/01
    www.example.com/02
    www.example.com/02/01

    This is easy enough to do - MODx supports it natively. However, I have a few branches of my document tree that I do not wish to be part of the site structure, so I’m using the ’site start’ option to define a sort of ’site root’, sending users to a particular node when they reach my site, like so:

    01
    01.01
    01.02
    ...
    01.04
    01.04.01
    02 <-- ’site start’ points here
    02.01
    02.02
    02.02.01
    02.02.02
    02.03
    02.04
    02.04.01
    03
    03.01
    ...
    03.03
    03.04

    Thus, the parts of my site which I want people to see are the following URLs:

    www.example.com/02
    www.example.com/02/01
    www.example.com/02/02
    www.example.com/02/02/01
    www.example.com/02/02/02
    www.example.com/02/03
    www.example.com/02/04
    www.example.com/02/04/01

    Everything else on the tree does not need to be accessible via a URL. I can do this fine, but I then have an unnecessary "02/" at the begining of each URL. The solution I would like is to somehow ’snag’ all URLs before MODx parses them, and inject the "02/" at the begining - therefore effectively "masking" the "02/" while retaining its functionality. Note that I [think I] can do this to ALL URLs, since ALL URLs should be children of the "02" document.

    Would this be a good solution? I would like to avoid cracking open the .haccess file if I can, and just write a short little plugin. I have not written any plugins yet, and I’m finding the documentation to be rather sparse. Can someone point me in either the direction of a solution or better plugin documentation?

    Thanks so much!