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

    It seems there is a bug wih Friendly URLs - or I am missing something !
    On my test site I have the following structure :
    Document1
    Document2
    Folder3
    |-Document4
    |-Document5

    In my configuration, I set
    Use Friendly URLs -> yes
    Use Friendly Aliases -> no
    Cache is cleared.

    Then, if I go to page 2, ie www .site.com/2.html (this works fine), the link for page 1 is... 2.html !!! (and in fact, it’s the same on every page : link for document 1, ie [[~1]] returns nothing... and in Wayfinder, it shows as the actual page adress - note that without friendly url, it works just fine)

    Now, if I go to page 4, link is www .site.com/4.html. But on page 3, link is www .site.com/3/ ; Then all links from page 3 are : 3/[link], and send to www .site.com/3/[link] (ie : www .site.com/3/2.html or www .site.com/3/3/), thus giving a page error.

    If I use Friendly Aliases -> yes, behaviour is nearly the same (document 1 link is empty, links from a "virtual folder" won’t go back to the root...) except that children documents (in my exemple 4 and 5) are linked within their parent’s "virtual folder", ie "document3/document4.html"

    So, am I missing something (in that case, please someone be kind to explain it to me), or is this a bug (in which case maybe someone has a fix)

    Thanks
    • Does not work in 0.9.7 without aliases; I don’t understand the point. But someone is welcome to help code that feature back in if they want to.
        • 29606
        • 63 Posts
        Ok, I wasn’t very clear on this, so I’ll explain with an exemple :

        In my configuration, I set
        Use Friendly URLs -> yes
        Use Friendly Aliases -> yes
        Cache is cleared.

        Same structure as shown in my first message.

        I start at the root page : site.com

        If I click on Document2 in wayfinder, I am now in site.com/document2.html
        Now, the link to Document1 is : document2.html (well, in fact, in source code, href is empty, so it links to itself - it is not Wayfinder related, as code [[~1]] returns nothing)
        Link to other documents are normal, ie : document2.html, folder3/, folder3/document4.html...
        I go to folder3 : I am now in site.com/folder3/ (and see my page), then if I click on Document2, I will go to site.com/folder3/document2.html, which doesn’t exist ; If I click on Document4 (under folder3), I will go to site.com/folder3/folder3/document4.html - an error too, and so on.
        I works the same if I had gone to document4 directly.

        I tried without friendly aliases just for comparison purpose, as you said, there is no point to it, but behaviour is a bit different :
        Use Friendly URLs -> yes
        Use Friendly Aliases -> no
        Cache is cleared.

        I start again at the root page : site.com

        If I click on Document2 in wayfinder, I am now in site.com/2.html
        href for the first document is still empty.
        Link to other documents are : 2.html, 3/, 4.html... We see that now, links don’t take the folder into account.
        I go to folder3 : I am now in site.com/3/ (and see my page), then if I click on Document2, I will go to site.com/3/2.html, which doesn’t exist ; If I click on Document4 (under folder3), I will go to site.com/3/4.html - note that it did not add another "3/" part, as links without aliases directly point to documents, even though it still points on a document that does not exist. But if I click again on Folder3, then I will go to site/com/3/3/, which of course doesn’t exist.
        If I had gone to document4 directly I would be on site.com/4.html, which works...

        Si as I understand it, there is a problem with friendly urls for the link to document ID 1 : [[~1]] and only this one, as for others id, it works fine.
        there is also a problem with children documents and links that are relative to actual url, and not the root path of ModX.

        I believe it is simply a small part of code to correct, but I have no idea where to look...

        [EDIT] : behavior with Friendly Aliases but without "use friendly alias path" is the same as without Friendly Aliases.
          • 33033
          • 43 Posts
          Do you have
          <base href="http://domain.com/" />
          in your site template?
            • 29606
            • 63 Posts
            I had, but wrongly put :
            <base href="[[++base_url]]" />

            I changed it to <base href="[[++site_url]]" />, and now it works just fine, thanks a lot !!!!

            One thing I still don’t get is why [[~1]] returns an empty string, but I don’t think this is much a problem.