7 Replies Latest reply: Dec 11, 2013 1:32 PM by Nancy O. RSS

    How to make site root-relative links work in DW and Server both?

    oasis design

      See details on buggy DW image link behavior, below. My question is:

       

      1) how to make site root-relative links work in DW and Server both? Or…

       

      2) how to reliably automate the change of several hundred legacy root-relative links of the form

      /images/image.jpg  to document-relative?

       

      That is, to

      ../images/image.jpg or

      ../../images/image.jpg or

      ../../../images/image.jpg etc…depending on where the directory is.

       

      The old format (/images/image.jpg ) used to work fine in my previous DW 8 configuration but appear grey in DW after “upgrading” to DW cs5.5 mac. (they look fine on the server, but it’s hard to edit image-heavy pages locally when they are all grey).

       

      I tried changing the files to how DW creates root relative links now:

      /public_html/images/image.jpg, which is a very easy, attractive root flow since there’s a one-to-one mapping. These look great in DW but are broken on the server!

       

      I looked at the “advanced” site setup, and it looked like it might be possible to nuke the /public_html/ part of my server info…but it also looked like there was the potential for doing damage changing these settings, which are automatically generated from our server connection settings, which seem to work.

       

      The “links relative to document/ site root” toggle…does that change how DW interprets existing links, or just change the default when you are adding a link?  I have made 80% of the file links document relative…before wondering if root-relative isn’t better?

      It sure seems less ambiguous for all those images if theres a way to make root relative work for DW design view, DW link check, and server.

       

      Summary of buggy behavior: (see test with images here)


      "old style" site root link

            /images/img_book/WScover120x150_NEW.jpg

            Design veiw in DW: broken (grey w/ broken icon)

            Link check in DW: "external link" (i.e., uncheckable, + file could appear orphaned)

            Browser: good

            Ease of switching: n/a (existing format)

       

      "new style" site root relative link

            /public_html/images/img_book/WScover120x150_NEW.jpg

            Design veiw in DW: good

            Link check in DW: good

            Browser: broken

            Ease of switching: easy

       

      Document relative link

            ../../images/img_book/WScover120x150_NEW.jpg

            Design veiw in DW: good

            Link check in DW: good

            Browser: good

            Ease of switching: hard (how to automate?)

       

      Absolute link

            http://www.oasisdesign.net/images/img_book/WScover120x150_NEW.jpg

            Design veiw in DW: broken (grey w/ broken icon)

            Link check in DW: external (i.e., uncheckable, + file could appear orphaned)

            Browser: good

            Ease of switching: n/a...not a real option

       

      Thanks!

       

      Similar discussion on "/"

        • 1. Re: How to make site root-relative links work in DW and Server both?
          Jon Fritz II CommunityMVP

          Public_html folder should not be included in your links

           

          That folder shouldn't exist in your Local Root Folder since it's the name of your Server Root.

           

          You never transfer the actual root folder to the server, you just transfer the contents of the local root, for instance from "My Fantastic Site" (or whatever you call your local site folder) to the server root (public_html). Public_html should never appear in any of your links because it suggests the viewer would be able to go above your root directory (which they can't) on your site.

           

          You most certainly cannot nuke public_html. That folder is the server root. If you were even capable of removing it (most hosting companies will not allow it) your site would cease to function.

           

          Do you have a local testing server set up so you can preview your site root relative links?

           

          http://www.adobe.com/devnet/dreamweaver/articles/setup_testing_server.html

          • 2. Re: How to make site root-relative links work in DW and Server both?
            oasis design Community Member

            Hello again Jon!

             

            Thanks for jumping on this.

             

            1. All clear and understood about where publc_html is etc.
            2. No contemplation of nuking the actual public_html directory on the server, just the "/public_html" text string at the start of the DW-generated links.
            3. "/public_html" is automatically added to the front of the link in DW if I create the link with any of the GUI tools, if I have "site root relative" selected. And ""/public_html" ends up in the code, and gets uploaded that way to the server, where it (obviously) doesn't work.
            4. Doesn't sound like it is supposed to work this way. Also, what seems to be the usual root relative format (/images/image.jpg) shows as a broken link in the GUI and an external link in the DW link check. All this togther makes me thinkI have some obscure setting incorrect?

              The setting that caught my eye is manage sites/ site setup/ advance settings/ local info/ web url,  which is automatically set to http://www.oasisdesign.net/public_html/

              it gives an option to change it but it makes every effort to make this NOT look like something users should mess with:
              Screen Shot 2013-12-11 at 7.35.31 PM.png
              Having gone through the more careful thought process during this post, I'm ready to do the experiment of changing the remote server web URL (why is it wrong by default?)...think I'll eat dinner first so there's 45 min to avert disaster if anyone knows this to be a bad idea!

              Art

            5. PS--don't  have a local testing server...don't think this will solve the GUI broken link/ link shows as external problems.
            6. Is there an easy, automated way to change links sitewide from document to root relative?
            • 3. Re: How to make site root-relative links work in DW and Server both?
              Nancy O. CommunityMVP

              In think your site definition is set-up wrong.  public_html should not be anywhere in your local site.  It belongs in your remote site definition under Root Directory.  See screenshot.  In my example, the server's Root Directory is htdocs/.  This is where you put public_html

               

              CS6-remote-site-root-folder.jpg

               

               

               

              Nancy O.

              • 4. Re: How to make site root-relative links work in DW and Server both?
                oasis design Community Member

                This helps a GREAT deal...and extremely timely, too.

                 

                Changing this configuration looks like it is enabling the link check to function properly, which is saving a ton of work, and we can see our images now, too. Thank you!

                 

                I rebuilt the site and program cache after...am crossing my fingers that this helps with some of the other buggy behavior; changing a broken link sitewide was very unpredictable, etc.

                 

                Now if only I can figure out the dissappearing spaces around library items we'll be in good shape for another year or two...

                 

                Art

                • 5. Re: How to make site root-relative links work in DW and Server both?
                  Nancy O. CommunityMVP

                  Can you post a link to one of  your problem pages?

                  • 6. Re: How to make site root-relative links work in DW and Server both?
                    oasis design Community Member

                    The problems are mostly in dreamweaver, with just certain symptoms visible on the site.

                     

                    The most visible on site is the:

                    Bug? Spaces around library items dissappear on update of library item

                    Since I posted about this seperately I've added a post with a link to it in it's own thread (click above).

                     

                    Broken links certainly affect the site, but I'm guardedly optimistic that I'm on the road to fixing that.

                     

                    The rest of the problems are in DW; frequent crashes, almost all on sitewide search, (not on any other sitewide operation)

                     

                    One particulary freaky one was that if you said yes to updating other instances of a broken link, it would randomly write that link over other entirely unrelated links. Thus, "Unsubscribe" linked to "buy one of everything" --a great way to win over customers, that one.

                    • 7. Re: How to make site root-relative links work in DW and Server both?
                      Nancy O. CommunityMVP

                      I want to see your code with the library items inserted.  I'm still betting you have code errors that DW is having a hard time reconciling -- which might also explain some of your problems in the software.  If you don't want to share your code in a public forum,  I understand.  Use the W3C validation tools on one of your live pages to see what comes up.

                      http://validator.w3.org/

                       

                       

                      Nancy O.