We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36532
    • 8 Posts
    Hello again,

    I'm trying to get URLs that are generated from [[~[ [+id] ]]] (spaces added so it is not escaped in the forum) to show as absolute paths. For now, I have made a little chunk with "/modx_folder/" in it. I put that chunk in front any URL in my templates so the links are absolute. Is there native option to generate absolute paths ? If yes, I guess using it would be better than to use a chunk, which is why I'm asking.

    In case you're wondering why I'm trying to get absolute paths, it's because on the page "localhost/articles", links to different articles are relative like "articles/category/article_name".
    That makes me end up on the page "localhost/articles/articles/category/article_name", which doesn't work. Maybe it's my templates being wrong from the start. No idea.

    This is the chunk used to display a list of last articles with getResources, which produces the unwanted relative paths:
    Chars were getting escaped by the forum engine. See attachment.

    Any help is highly appreciated.

    Best regards,
    CK [ed. note: conradk last edited this post 15 years, 1 month ago.]
      • 22303 MODX Staff
      • 10,725 Posts
      You need to add this to your HEAD for your MODX Templates:

      <base href="[[!++site_url]]">


      This will resolve your issue with alias path links.

      Alternatively, you can have MODX generate individual links as absolute by using this syntax:

      [[~[[+id]]? &scheme=`full`]]


      or have all links generated this way automatically by setting the default link_tag_scheme in system settings to the value "full".

      That said, I recommend starting by adding the base tag. Otherwise, requests to virtual sub-directories within your site will not render your error_page properly when handling 404s.
        • 36532
        • 8 Posts
        Oh cool ! Thanks.

        I'll try to look harder into the docs next time :s