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

    When trying to get "Use friendly alias path:" working I found that site_url is generated so that it points to <www.domain.com/folder> instead of <www.domain.com> as I would expect.

    It seems to me that no one has asked about this since 2005 so it might be me misunderstanding something, or is this feature broken?

    Regards,

    Erik
      • 4310
      • 2,310 Posts
      I believe that’s exactly what it’s meant to do.
      "Use friendly alias path: Yes" would generate the URL www.your-domian.com/parent/child.html
      "Use friendly alias path: No" would be www.your-domian.com/child.html
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I don’t see where the site_url variable itself is changed, it’s just that the path is added to it when friendly alias paths is on.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 8616
          • 4 Posts
          Thanks for answering.

          @bunk58, yes, I guess you just misunderstood my first post, thats exactly what I try to achieve.

          The problem occurs when I try to do <base href="[(site_url)]"></base> (this might be stupid, but it’s suggested here: http://wiki.modxcms.com/index.php/Making_QuickEdit_work_with_Friendly_URLs, and as far as I can remember, a couple of other places as well.) and base changes and breaks all paths to css files whenever I go to an article one level down in the hierarchy, or when all links in menus from my-domain.com/parent/child.html points to my-domain.com/parent/parent2.html, when they should have pointed to my-domain.parent2.html, because wayfinder seems to use site_url internally.

          (OK, i guess the above was not clear, this is what I meant:)
          root
          - parent1
          -- child
          - parent2
          


          BTW: The problem is solved by just commenting out the code to find base_url and site_url, and just hard coding them. Might break something else, but so far it works nicely.
            • 22303 MODX Staff
            • 10,725 Posts
            Using the base tag with site_url is recommended; I use it on all sites regardless if I use friendly alias paths, in case 404’s are returned from paths that don’t exist by MODx itself. This will make your site a whole lot more portable, as well.
              • 8616
              • 4 Posts
              I know I’m not good at explaining things (I once failed to explain why we should use email aliases to a former boss smiley )

              So I give it another try:

              Out of the box, on my web host, [(site_url)] returns something like http://my-domain/folder when I’m at the page http://my-domain/folder/page, and http://my-domain/ when I’m on the page http://my-domain/page.

              This (obviously ..?) breaks links to css and links generated by wayfinder.

              So my question is:

              • Is this expected behavior (I just can’t belive that),
              • have I done something wrong (.htaccess comes to mind),
              • has the web host done something wrong,
              • or have I found a bug?

              Regards,

              Erik
                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: eitland at Sep 03, 2008, 05:59 PM

                Out of the box, on my web host, [(site_url)] returns something like http://my-domain/folder when I’m at the page http://my-domain/folder/page, and http://my-domain/ when I’m on the page http://my-domain/page.
                This is not expected behavior. The site_url should be the same regardless of what friendly alias path is; this is why it is recommended on sites that use friendly alias paths. I’ve never heard of this problem before, anyone have any ideas? Did you modify the default rewrite rules at all in .htaccess?
                  • 8616
                  • 4 Posts
                  I think the answer is both yes and no.

                  Think I’ve tried with both modified and unmodified .htaccess .

                  I will try again with an unmodified .htaccess and come back with the results.