Loading ...
Sorry, an error occurred while loading the content.

Absolute to Relative HTML Address Converter Clip

Expand Messages
  • clipuser
    Does anyone know of a clip that will convert Absolute URLs contained in HTML code into Relative URLs based on the folder structure in which the HTML files are
    Message 1 of 5 , Sep 18, 2007
    • 0 Attachment
      Does anyone know of a clip that will convert Absolute URLs contained
      in HTML code into Relative URLs based on the folder structure in which
      the HTML files are contained?

      I have drafted many pages with many links for a new web site using
      absolute addresses. I used absolute addresses so that I can test them
      on my PC before publishing them. (I wanted to avoid the hassle of
      revising a large number of relative addresses each time I revised the
      evolving folder structure.) Now I want to convert the addresses to
      relative addresses before uploading them to the server.
    • Jeff Scism
      ... Jeff Jeffery G. Scism, IBSSG ~~ Blacksheep Ancestors in your Family? Blacksheep Genealogy is a registered California Sole Proprietorship. The
      Message 2 of 5 , Sep 18, 2007
      • 0 Attachment
        clipuser wrote:
        >
        > Does anyone know of a clip that will convert Absolute URLs contained
        > in HTML code into Relative URLs based on the folder structure in which
        > the HTML files are contained?
        >
        > I have drafted many pages with many links for a new web site using
        > absolute addresses. I used absolute addresses so that I can test them
        > on my PC before publishing them. (I wanted to avoid the hassle of
        > revising a large number of relative addresses each time I revised the
        > evolving folder structure.) Now I want to convert the addresses to
        > relative addresses before uploading them to the server.
        > >>>>
        >
        > I would also find such a clip useful, I am currently moving 20,000
        > data pages to a new URL, and want them to be "relative" within the
        > site, making storing them on a CD-rom as self standing sites a
        > possibility.


        > My first thought would be to establish a base url as a point of
        > reference. and make the urls all relative to that base url.













        Jeff


















        Jeffery G. Scism, IBSSG
        ~~

        Blacksheep Ancestors in your Family?
        'Blacksheep Genealogy' is a registered California Sole Proprietorship.
        The International Black Sheep Society of Genealogists is a Social Organization Identified by its members using IBSSG after their signatures.
      • notetab_is_great
        ... Um. By avoiding the hassle of revising a large number of relative addresses each time you revised the evolving folder structure, did you not replace that
        Message 3 of 5 , Sep 18, 2007
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "clipuser" <clipuser@...> wrote:
          >
          > Does anyone know of a clip that will convert Absolute URLs contained
          > in HTML code into Relative URLs based on the folder structure in which
          > the HTML files are contained?
          >
          > I have drafted many pages with many links for a new web site using
          > absolute addresses. I used absolute addresses so that I can test them
          > on my PC before publishing them. (I wanted to avoid the hassle of
          > revising a large number of relative addresses each time I revised the
          > evolving folder structure.) Now I want to convert the addresses to
          > relative addresses before uploading them to the server.


          Um. By avoiding the hassle of revising a large number of relative
          addresses each time you revised the evolving folder structure, did you
          not replace that with the identically-sized hassel of revising a large
          number of absolute addresses each time you revised the evolving folder
          structure? Plus, it leaves you with the hassle of now converting
          absolute to relative addresses.

          Since I always start with relative addresses, I don't have existing
          tools for converting absolute to relative... as a general outline of
          how, though, one would have to take an absolute URL such as

          file://c:/website/top/

          and figure the equivalent

          http://myhost.com/mywebsite/top/

          and then one could convert from absolute-on-PC to absolute-on-webhost
          with a simple search-and-replace.

          To convert to relative, one would have to (1) know the top (2) know
          the absolute for a given file [shouldn't be a problem when examining
          that file] (3) chop off the "top" part of each contained URL, and add
          enough "../" to each contained URL to get from the file's position to
          the top.

          Hence, in file

          file://c:/website/top/foo/bar/file.html each contained URL would need
          the "top" part of contained URLs replaced by "../../", whereas in
          file://c:/website/top/baz/other.html each contained URL would need the
          "top" part of the contained URLs replaced by "../".

          That would not necessarily be a minimal relative path, but would be
          relative.

          For minimality, one would need to compare paths from the file and the
          contained URL for commonality after the top, to reduce by the number
          of "../" added, and to chop one more prefix directory name off, for
          each prefix match found.

          Glenn
        • Axel Berger
          ... I don t see you logic. With absolute you have to work in every little change, relative stays the same if you move several things together. That said you
          Message 4 of 5 , Sep 18, 2007
          • 0 Attachment
            clipuser wrote:
            > (I wanted to avoid the hassle of revising a large number of
            > relative addresses each time I revised the evolving
            > folder structure.)

            I don't see you logic. With absolute you have to work in every little
            change, relative stays the same if you move several things together.

            That said you now want to redo lots of files. The relative position does
            not only depend on the target but also the file you are working on - not
            easy. My suggestion would be to go half way and make all URLs start from
            your root.
            I.e. every "http://mydomain.com/first/second/third/file.htm" becomes
            "/first/second/third/file.htm" beginning with a slash. Of course
            "fourth/image.jpg" is nicer than "/first/second/third/fourth/image.jpg"
            but you have to balance nicety against effort.

            The disadvantage is that those links won't work on your drive at home.
            But there you have
            subst b: f:\myprojects\current_project
            best run from a batch.
            Then your project sits in the root of B: at home and the root of the
            server when submitted.

            Axel
          • Don - HtmlFixIt.com
            ... Search and replace either straight up or regex. You should simply be removing the same thing from the front of every url it seems to me. I have a client
            Message 5 of 5 , Sep 18, 2007
            • 0 Attachment
              clipuser wrote:
              > Does anyone know of a clip that will convert Absolute URLs contained
              > in HTML code into Relative URLs based on the folder structure in which
              > the HTML files are contained?
              >
              > I have drafted many pages with many links for a new web site using
              > absolute addresses. I used absolute addresses so that I can test them
              > on my PC before publishing them. (I wanted to avoid the hassle of
              > revising a large number of relative addresses each time I revised the
              > evolving folder structure.) Now I want to convert the addresses to
              > relative addresses before uploading them to the server.
              >
              Search and replace either straight up or regex. You should simply be
              removing the same thing from the front of every url it seems to me. I
              have a client who pays me to do this all the time using notetab.
            Your message has been successfully submitted and would be delivered to recipients shortly.