Subdirectories/folders as URLs? (novice question)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AES/newspost

    Subdirectories/folders as URLs? (novice question)

    My understanding -- I'm not an expert -- is that on (some? many? all?)
    standard Internet servers a URL can point to a subdirectory name
    followed by a backslash, and that links to this URL will automatically
    go to an "index.html " file located in that subdirectory, if there is one.

    Q1: Is this more or less correct?

    At least some HTML texts also recommend using this as the basis for
    organizing a web site: Put the web pages associated with some specific
    or isolated subtopic into an appropriately named subdirectory (or
    subsubdirectory ) within the main web site's top level directory; use an
    index.html file located in that subdirectory to serve as the "home
    page" for links to those subtopic pages within that subdirectory; and
    use the subdirectory's name as the primary URL for linking to that
    subtopic from outside or from higher up in the web site hierarchy.

    Q2: Is this good advice?

    But if I'm attempting to develop and test a complete web site on my own
    (Mac iBook OS 9) computer before uploading it to my university's server,
    I can't do this, because subdirectories are folders in this environment
    and as best I can tell browsers operating on my own machine can't link
    to folders as URLs.

    Q3: If this is correct, is there any way around it? (at the Mac OS 9
    level, or if I upgrade to Mac OS X)

    Thanks for any advice or assistance.
  • Dave Patton

    #2
    Re: Subdirectories/folders as URLs? (novice question)

    AES/newspost <siegman@stanfo rd.edu> wrote in news:siegman-
    A6D3DB.10234701 082004@news.sta nford.edu:
    [color=blue]
    > My understanding -- I'm not an expert -- is that on (some? many? all?)
    > standard Internet servers a URL can point to a subdirectory name
    > followed by a backslash, and that links to this URL will automatically
    > go to an "index.html " file located in that subdirectory, if there is one.
    >
    > Q1: Is this more or less correct?[/color]

    "\" is a backslash, "/" is a slash or forwardslash. It's not clear
    from your wording if you think backslashes can be used in URLs.

    As for 'indexing a directory', here's how Apache handles it:


    [color=blue]
    > At least some HTML texts also recommend using this as the basis for
    > organizing a web site: Put the web pages associated with some specific
    > or isolated subtopic into an appropriately named subdirectory (or
    > subsubdirectory ) within the main web site's top level directory; use an
    > index.html file located in that subdirectory to serve as the "home
    > page" for links to those subtopic pages within that subdirectory;[/color]

    So far, so good (maybe) ....
    [color=blue]
    > and use the subdirectory's name as the primary URL for linking to that
    > subtopic from outside or from higher up in the web site hierarchy.[/color]

    That may not be good advice. You might want to read
    "Cool URIs don't change" by Tim Berners-Lee:

    [color=blue]
    > But if I'm attempting to develop and test a complete web site on my own
    > (Mac iBook OS 9) computer before uploading it to my university's server[/color]

    You can't properly test on your own system anyway, because you
    haven't duplicated the university's webserver environment. For
    example, you might discover that thier webserver serves your
    pages with HTTP headers that cause you problems.

    --
    Dave Patton
    Canadian Coordinator, Degree Confluence Project
    The Degree Confluence Project contains photographs of the intersections of integer latitude and longitude degree lines.

    My website: http://members.shaw.ca/davepatton/

    Comment

    • Joel Shepherd

      #3
      Re: Subdirectories/folders as URLs? (novice question)

      In article <siegman-A6D3DB.10234701 082004@news.sta nford.edu>,
      AES/newspost <siegman@stanfo rd.edu> wrote:
      [color=blue]
      > My understanding -- I'm not an expert -- is that on (some? many? all?)
      > standard Internet servers a URL can point to a subdirectory name
      > followed by a backslash...[/color]

      I believe you mean a solidus: i.e., a forward-slash. But anyway...
      [color=blue]
      > and that links to this URL will automatically go to an "index.html "
      > file located in that subdirectory, if there is one.
      >
      > Q1: Is this more or less correct?[/color]

      It is if the webserver is configured appropriately. If the URL is only a
      path -- no document name appended -- the webserver can be configured to
      try to return a default document (e.g., "index.html ") for that path.
      Often several default document names can be specified, in a prioritized
      list.

      [color=blue]
      > At least some HTML texts also recommend using this as the basis for
      > organizing a web site:
      >
      > Q2: Is this good advice?[/color]

      Well, subdirectories are useful for organizing files, whether part of a
      web site or something else.

      Personally, w/regard to default documents, I'm a little on the fence as
      to their usefulness. On one hand, it can make life easier for both the
      visitor and author to not have to specify a full path (think,
      especially, of the home page). The main risk of relying on the server's
      default document configuration is that if the site is moved to a
      different server with a different configuration, well, the path-only
      links may no longer function. This is a small risk, however: it's likely
      you'll be able to configure the new server appropriately.

      Probably the more important thing, particularly from your visitor's
      point of view, is consistency. Don't use
      http://www.example.com/foo/index.html in some cases and
      http://www.example.com/foo/ in others ... if you intend them to refer to
      the same document. From the browser's point of view, they are different
      documents, which affects caching and visited-link highlighting.
      [color=blue]
      > But if I'm attempting to develop and test a complete web site on my own
      > (Mac iBook OS 9) computer before uploading it to my university's server,
      > I can't do this, because subdirectories are folders in this environment
      > and as best I can tell browsers operating on my own machine can't link
      > to folders as URLs.
      >
      > Q3: If this is correct, is there any way around it?[/color]

      No: the browser has nothing to do with it (almost: the exception is when
      the browser request is a path but doesn't end with a forward-slash).
      Default documents are handled by a webserver, not by the browser. You
      need to run a webserver on your laptop. I'm not sure if one is
      included/available for OS9, but OSX comes with Apache and easy setup
      instructions.

      --
      Joel.


      "May she also say with just pride:
      I have done the State some service."

      Comment

      • Stan Brown

        #4
        Re: Subdirectories/folders as URLs? (novice question)

        "AES/newspost" <siegman@stanfo rd.edu> wrote in
        comp.infosystem s.www.authoring.html:[color=blue]
        >My understanding -- I'm not an expert -- is that on (some? many? all?)
        >standard Internet servers a URL can point to a subdirectory name
        >followed by a backslash, and that links to this URL will automatically
        >go to an "index.html " file located in that subdirectory, if there is one.
        >
        >Q1: Is this more or less correct?[/color]

        Less. :-) The backslash is a Microsoftism for paths in Windows and
        DOS. In URLs the separator is a slash.

        For instance,

        gets the index page for my statistics course.

        A couple of notes:

        a. The page may or may not be called "index.htm" . That varies by
        server, so you should find out what the "default page" is for your
        server.

        b. Some servers are set up that if there's no default page present,
        a URL in the above form gets a directory listing, and then the
        visitor can choose by filename. Generally that's not a helpful
        interface, so it's usually good practice to make sure every
        directory has a default page present.
        [color=blue]
        >Put the web pages associated with some specific
        >or isolated subtopic into an appropriately named subdirectory (or
        >subsubdirector y) within the main web site's top level directory; use an
        >index.html
        >
        >Q2: Is this good advice?[/color]

        Generally yes. I think for novice Web authors we can drop the
        "generally" . :-)

        Advanced authors play all sorts of games with URLs, because the URL
        doesn't necessarily have to reflect a directory structure.
        [color=blue]
        >But if I'm attempting to develop and test a complete web site on my own
        >(Mac iBook OS 9) computer before uploading it to my university's server,
        >I can't do this, because subdirectories are folders in this environment
        >and as best I can tell browsers operating on my own machine can't link
        >to folders as URLs.
        >
        >Q3: If this is correct, is there any way around it? (at the Mac OS 9
        >level, or if I upgrade to Mac OS X)[/color]

        You can install a server on your computer, and if you're doing
        serious Web development you probably want to. I don't know of
        specific Mac software to suggest, though.

        --
        Stan Brown, Oak Road Systems, Tompkins County, New York, USA

        HTML 4.01 spec: http://www.w3.org/TR/html401/
        validator: http://validator.w3.org/
        CSS 2.1 spec: http://www.w3.org/TR/CSS21/
        validator: http://jigsaw.w3.org/css-validator/

        Comment

        • AES/newspost

          #5
          Re: Subdirectories/folders as URLs? (novice question)

          In article <MPG.1b77386399 4e20c198c7f4@ne ws.odyssey.net> ,
          Stan Brown <the_stan_brown @fastmail.fm> wrote:
          [color=blue][color=green]
          > > I'm attempting to develop and test a complete web site on my own
          > >(Mac iBook OS 9) computer before uploading it to my university's server,
          > >I'm limited in doing this because subdirectories are folders in this case
          > >and as best I can tell browsers operating on my own machine can't link
          > >to folders as URLs.
          > >
          > >Q3: If this is correct, is there any way around it? (at the Mac OS 9
          > >level, or if I upgrade to Mac OS X)[/color][/color]
          [color=blue]
          > You can install a server on your computer, and if you're doing
          > serious Web development you probably want to. I don't know of
          > specific Mac software to suggest, though.[/color]


          Thanks for these comments (and those from others) (and my reference to
          backslash was a careless error -- been doing too much TeXing).

          Just one followup: Using Netscape (only browser I've ever used) I can
          open the top level index.html file in the "web site" folder on my HD, or
          in fact open any html file within the nested folder structure in that
          web site folder, and view it as a web page.

          Once that's happened, moreover, I can properly follow properly coded
          relative links up and down throughout that (psuedo) web site, and also
          follow absolute links to outside sites as needed. By doing this, I can
          test my site to assure that all its links, relative and absolute, will
          function properly when its full contents (including subfolders) are
          uploaded to my university's site -- and this test can be done without
          any separate server being present on my computer.

          This only works, however, if all the relative links in my web site
          folder point only to other files, not subfolders, within this web site
          folder. I'm hypothesizing that Netscape _could_ at least in principle
          be made smart enough to follow relative links pointing to subfolders as
          well as to files, following the index.html convention, but just isn't
          programmed that way; and I'm wondering if any other (Mac-based) browsers
          are.

          Comment

          • Alan J. Flavell

            #6
            Re: Subdirectories/folders as URLs? (novice question)

            On Sun, 1 Aug 2004, AES/newspost wrote:
            [color=blue]
            > Just one followup: Using Netscape (only browser I've ever used)[/color]

            Oops, that's a rather telling comment...
            [color=blue]
            > I can open the top level index.html file in the "web site" folder on
            > my HD, or in fact open any html file within the nested folder
            > structure in that web site folder, and view it as a web page.[/color]

            Don't do it. Many of the best practices will fail to work in this
            situation. I really can't recommend anything less than installing a
            local web server of some kind.
            [color=blue]
            > This only works, however, if all the relative links in my web site
            > folder point only to other files, not subfolders, within this web site
            > folder.[/color]

            Just so. Handy things like href="../" and so on will simply fail to
            work. Spelling out index.html in an href is messy, and causes
            problems when you want to change to something else (index.php or
            whatever).
            [color=blue]
            > I'm hypothesizing that Netscape _could_ at least in principle
            > be made smart enough to follow relative links pointing to subfolders as
            > well as to files, following the index.html convention,[/color]

            You're just trying to design yourself into a corner, is the way that I
            see it.
            [color=blue]
            > but just isn't programmed that way; and I'm wondering if any other
            > (Mac-based) browsers are.[/color]

            That isn't how the web is designed to work. Knowledge of how to
            resolve a URL into actual resources resides in the server (and its
            configuration), not in the client. Attempts to work around that lead
            to too many restrictions. Several colleagues tried it despite my
            advice to the contrary - I've seen the problems that they experienced.

            I can't comment on your specific platform, but a colleague who runs OS
            X changed to running a local version of Apache and hasn't regretted
            it.

            Comment

            • Stan Brown

              #7
              Re: Subdirectories/folders as URLs? (novice question)

              "AES/newspost" <siegman@stanfo rd.edu> wrote in
              comp.infosystem s.www.authoring.html:

              (about testing a Web site on a local computer without installing a
              server)
              [color=blue]
              >Using Netscape (only browser I've ever used) I can open the top
              >level index.html file in the "web site" folder on my HD, or
              >in fact open any html file within the nested folder structure in that
              >web site folder, and view it as a web page.[/color]

              Well, yes. Sorry -- I thought you were already aware of that. Any
              browser I know of can do that.

              Not only that, in most browsers you can bookmark a local file, so
              you don't have to reopen the file manually if you test it
              frequently.
              [color=blue]
              >This only works, however, if all the relative links in my web site
              >folder point only to other files, not subfolders, within this web site
              >folder.[/color]

              True. Just be sure you're consistent in all internal references.
              Browsers generally don't know that blahblah/ and blahblah/index.htm
              point to the same resource, so they may not be able to use the
              cached copy of one if you reference the other.
              [color=blue]
              > I'm hypothesizing that Netscape _could_ at least in principle
              >be made smart enough to follow relative links pointing to subfolders as
              >well as to files, following the index.html convention, but just isn't
              >programmed that way;[/color]

              In principle any software can do anything, but even in principle the
              "feature" you suggest would be a mistake.

              Different sites use index.htm, or index.html, or default.htm, or
              default.html, with different rules about which one takes precedence
              when more than one is present. A browser would have no way to know
              these rules, and if it tried to guess it would guess wrong.

              When your browser requests

              it is saying "give me the main pagen in that directory"(*) -- the
              site knows what is the main page but the browser does not (and
              should not).

              (*) That's an oversimplificat ion, but for this discussion I'm
              assuming that the site has files organized into directories and that
              the URLs reflect that structure. As I mentioned earlier, that may or
              may not be true -- it's under control of the site designer.

              --
              Stan Brown, Oak Road Systems, Tompkins County, New York, USA

              HTML 4.01 spec: http://www.w3.org/TR/html401/
              validator: http://validator.w3.org/
              CSS 2.1 spec: http://www.w3.org/TR/CSS21/
              validator: http://jigsaw.w3.org/css-validator/

              Comment

              • Stan Brown

                #8
                Re: Subdirectories/folders as URLs? (novice question)

                "Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote in
                comp.infosystem s.www.authoring.html:[color=blue]
                >Just so. Handy things like href="../" and so on will simply fail to
                >work[/color]

                True, but is that really so terrible? (That's an honest question,
                not a disagreement.)

                At my college I'm stuck with an IIS server, so all my index pages
                are called default.htm. I code e.g. "../default.htm" instead of
                "../" everywhere, so that I can test locally.

                Granted, it's 11 extra characters in a few URLs. But, as has been
                pointed out here, even a very small image will likely swamp all such
                byte wastage.

                I agree with you that "../" is cleaner and more aesthetical(*) than
                "../default.htm", but is it really a problem for the visitors? All
                they care about is clicking on links(**) and having them work, which
                they will.

                (For me as author it's not a problem. I have a preprocessor macro
                #define indexpage default.htm
                and the day I install Apache, or the day the college gets better
                server software, I can just change it in the one file of
                definitions, type "make", and then upload all the revised pages.)

                (*) Is "aesthetica l" a word?

                (**) Oops, I mean "selecting links". :-)

                --
                Stan Brown, Oak Road Systems, Tompkins County, New York, USA

                HTML 4.01 spec: http://www.w3.org/TR/html401/
                validator: http://validator.w3.org/
                CSS 2.1 spec: http://www.w3.org/TR/CSS21/
                validator: http://jigsaw.w3.org/css-validator/

                Comment

                • Alan J. Flavell

                  #9
                  Re: Subdirectories/folders as URLs? (novice question)

                  On Mon, 2 Aug 2004, Stan Brown wrote:
                  [color=blue]
                  > At my college I'm stuck with an IIS server, so all my index pages
                  > are called default.htm.[/color]

                  Not .asp? (SCNR)
                  [color=blue]
                  > I code e.g. "../default.htm" instead of
                  > "../" everywhere, so that I can test locally.[/color]

                  Think about what happens if and when there's some reason that you need
                  to change that. Worse - folks who have bookmarked your site will have
                  to change too. IMHO that is imposing an unnecessary constraint on
                  your readers - for no better reason than your own convenience.

                  Even if you can rewrite your own site at the click of a macro
                  processor - think about those other links. (What will the indexing
                  robot do for your external link rating when it finds that the old
                  links into your site now point to a 30x redirection, or worse, to a
                  404 not found?).
                  [color=blue]
                  > Granted, it's 11 extra characters in a few URLs. But, as has been
                  > pointed out here, even a very small image will likely swamp all such
                  > byte wastage.[/color]

                  Oh, sure, fully agree with _that_ bit. Shorter URLs are nice to have,
                  but a relatively small advantage, and by no means the chief reason for
                  recommending "./" and friends.
                  [color=blue]
                  > I agree with you that "../" is cleaner and more aesthetical(*) than
                  > "../default.htm", but is it really a problem for the visitors? All
                  > they care about is clicking on links(**) and having them work,[/color]

                  Bookmarks to your site. Other people's links to your site.

                  No: I'm definitely on Dan's side of the fence on this issue:

                  Tips on the use of subdirectories and their index HTML files in Web site development.


                  cheers

                  Comment

                  • Philipp Lenssen

                    #10
                    Re: Subdirectories/folders as URLs? (novice question)

                    Alan J. Flavell wrote:
                    [color=blue]
                    >
                    > No: I'm definitely on Dan's side of the fence on this issue:
                    >
                    > http://webtips.dan.info/subdir.html#LinkHome
                    >[/color]

                    After reading through that part, what do you have against linking back
                    to the homepage via "/" (this is what I do too)? Or did I misunderstand
                    this.

                    --
                    Google Blogoscoped
                    A daily news blog and community covering Google, search, and technology.

                    Comment

                    • Kris

                      #11
                      Re: Subdirectories/folders as URLs? (novice question)

                      In article <MPG.1b77386399 4e20c198c7f4@ne ws.odyssey.net> ,
                      Stan Brown <the_stan_brown @fastmail.fm> wrote:
                      [color=blue][color=green]
                      > >Q3: If this is correct, is there any way around it? (at the Mac OS 9
                      > >level, or if I upgrade to Mac OS X)[/color]
                      >
                      > You can install a server on your computer, and if you're doing
                      > serious Web development you probably want to. I don't know of
                      > specific Mac software to suggest, though.[/color]

                      OS X has an Apache server pre-installed, which will be enabled when you
                      switch on Personal Web Sharing in Sharing/System Preferences.

                      --
                      Kris
                      <kristiaan@xs4a ll.netherlands> (nl)

                      Comment

                      • Alan J. Flavell

                        #12
                        Re: Subdirectories/folders as URLs? (novice question)

                        On Mon, 2 Aug 2004, Philipp Lenssen wrote:
                        [color=blue]
                        > After reading through that part, what do you have against linking back
                        > to the homepage via "/" (this is what I do too)?[/color]

                        Excuse me? If I gave the impression that I had anything against
                        linking to the site's "home"[1] page like that, then it *was* a
                        misunderstandin g.

                        I do have a problem though with the use of the word "back" in that
                        context, In conventional browsing terminology, "back" means "pop the
                        URL history stack". There's no reason that the reader has ever
                        visited that page before - many of them enter the site at a targetted
                        page, thanks to a search engine (as we can see from the server logs)
                        without having ever visited the "home" page, so it's illogical to
                        suggest to them that going to the home page will necessarily
                        correspond to /their/ concept of "back".

                        But yes:

                        "./" refers to the default document at the current hierarchy level,

                        "../" refers to the default document at the next hierarchy level "above"[2]

                        "/" refers to the default document at the root of the current
                        (virtual) server.

                        These are all respectable relative URLs, and should refer to some kind
                        of overview or index document for the respective level. What the
                        document is called on the server is not known to the client, and does
                        not need to be known: it might be index.html or Default.htm or
                        Overview.php; or it might not exist at all, and be generated
                        automatically by the server. Whatever it is today, it might be
                        something different next week - but the URL will not need to change.

                        Have I made that any clearer? You might or might not agree, but at
                        least I would like to clear up any misunderstandin g.

                        all the best

                        [1] Early web documents draw what seems to me to be a useful
                        distinction between a "home" page and a "welcome" page. See

                        under the heading "Welcome home?". It's a pity that this
                        useful distinction seems to have been blurred with time.

                        [2] "above" in the sense of the conventional view of a hierarchy which
                        is rooted at the top - contrary to the botanical view ;-)

                        Comment

                        • Harrie

                          #13
                          Re: Subdirectories/folders as URLs? (novice question)

                          Alan J. Flavell said the following on 02/08/2004 18:48:
                          [color=blue]
                          > "./" refers to the default document at the current hierarchy level,
                          >
                          > "../" refers to the default document at the next hierarchy level "above"[2]
                          >
                          > "/" refers to the default document at the root of the current (virtual)
                          > server.
                          >
                          > These are all respectable relative URLs[/color]

                          Is the last one a relative URL? If so, is that because their might be
                          (a) virtual server(s) involved?

                          I was under the impression that the last one is an absolute path, in
                          this case without a protocol and servername part.

                          Regards,
                          Harrie

                          Comment

                          • Alan J. Flavell

                            #14
                            Re: Subdirectories/folders as URLs? (novice question)

                            On Mon, 2 Aug 2004, Harrie wrote:
                            [color=blue][color=green]
                            >> "/" refers to the default document at the root of the current (virtual)
                            >> server.
                            >>
                            >> These are all respectable relative URLs[/color]
                            >
                            > Is the last one a relative URL?[/color]

                            It's "relative" in the sense that it needs to be completed by adding
                            the protocol, host (and port, if other than 80) parts to make it into
                            an absolute URL.
                            [color=blue]
                            > I was under the impression that the last one is an absolute path,[/color]

                            You're absolutely right ;-)

                            Or "absolute URLpath", as some would say

                            But it's still a kind of "relative URL".

                            all the best

                            Comment

                            • Harrie

                              #15
                              Re: Subdirectories/folders as URLs? (novice question)

                              Alan J. Flavell said the following on 02/08/2004 20:48:
                              [color=blue]
                              > On Mon, 2 Aug 2004, Harrie wrote:
                              >[color=green][color=darkred]
                              >>> Alan J. Flavell said the following on 02/08/2004 18:48:
                              >>>
                              >>> "/" refers to the default document at the root of the current
                              >>> (virtual) server.
                              >>>
                              >>> These are all respectable relative URLs[/color]
                              >>
                              >> Is the last one a relative URL?[/color]
                              >
                              > It's "relative" in the sense that it needs to be completed by adding the
                              > protocol, host (and port, if other than 80) parts to make it into an
                              > absolute URL.[/color]

                              I would call that full qualified, but I kind of deduced that from FQDN.
                              Not sure what the proper word for it is, somebody knows?

                              Best regards,
                              Harrie

                              Comment

                              Working...