We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Ever since I started using MODx, I have always used clean URLs with the "Use friendly alias path" set to "Yes".
    Also, I have been using the "Rewrite browser paths" set to "Yes" to keep relative paths rather than absolute ones.

    I had never had a problem with that or noticed anything before I used the DirectResize plugin. My images have relative paths, which the plugin’s default config require. The first time I save the document, the plugin generates the resized image and points toward the cached, resized images. But if I edit the document later, all my images have an absolute path, breaking the cached resized image undecided

    When I dug into the MODx configuration, I found a warning I never paid attention to :

    NOTE: When setting this option to ’Yes’ (turning on alias paths), reference items (such as images, css, javascripts, etc) using the absolute path: e.g., ’/assets/images’ as oppose to ’assets/images’. By doing so you will prevent the browser (or web server) from appending the relative path to the alias path.

    This explained the relative path turning into absolute ones, but why oh why isn’t it possible to have both friendly alias path AND rewrite browser paths ?

      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: davidm at Oct 01, 2007, 09:49 AM

      This explained the relative path turning into absolute ones, but why oh why isn’t it possible to have both friendly alias path AND rewrite browser paths ?
      Rewrite browser paths is IMHO a legacy hack that should go away; I believe it is simply rewriting your already relative paths to absolute ones. Your relative paths should be maintained correctly without that setting.
        • 6726
        • 7,075 Posts
        Thanks for the quick answer, this means I have been misinterpreting the help text for this setting, and that we should change it (it default to Yes and advises to keep that setting) :

        If this is set to ’No’, MODx will write file browser resource src’s (images, files, flash, etc.) as absolute URLs. Relative URLs are helpful should you wish to move your MODx install, e.g., from a staging site to a production site. If you have no idea what this means, it’s best just to leave it set to ’Yes’.

        I have tried setting it to NO but it doesn’t change the fact that my images end up with the full path e.g

        <img src="h**p://mywebsite.tld/assets/images/my-image.jpg />

        instead of

        <img src="assets/images/my-image.jpg />

        ???
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 22303 MODX Staff
          • 10,725 Posts
          What is the resource browser URL specified in your configuration? Is it absolute or relative?
            • 6726
            • 7,075 Posts
            I didn’t have to edit the default values set at install, which is an absolute path [tt]/home/*****/*****/assets/[/tt]

            I never thought it could work with a relative path, would that fix my problem ?
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 22303 MODX Staff
              • 10,725 Posts
              Not the file system path, but the URL setting; it might be ’http://domain.tld/assets/’ or it could be just ’assets/’...
                • 6726
                • 7,075 Posts
                Uh OK sorry the URL setting is indeed absolute !

                I’ll try change that, thanks !

                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 6726
                  • 7,075 Posts
                  You were right Jason, this fixes it, I learned something valuable here !

                  Thanks grin
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id