|
|
|
|
|
|
#1 |
|
Founding Sysop
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
|
This is going to seem pretty elementary, I guess, but I feel as if I am confused about how to handle multiple directories on the server.
Is it good practice to have an “index.html” file in every directory? I know it is necessary at the root, but what about the subordinate directories? And the smaller ones within those? I wonder if I have been creating more index pages than I really need to. (I just tore down the site as it was, so cannot show anything right now.) __________________ :: |
|
|
|
|
|
#2 | |
|
Member
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
|
Quote:
The first consideration is whether you'll allow site visitors to directly "browse" a directory. If a directory contains a number of downloadable files, say, or graphics, or even just a collection of articles (not necessarily in HTML format), you may well want to allow visitors to browse the directory directly, without having an "index" page - which is what a file called "index.html" or similar was intended for. You could easily add new files to the directory without ever needing to update the "index" file to give access to them: the web server can do that on its own (even though it may not look pretty: it's functional). In this case you need to 1) configure the web server to actually allow directory browsing (or do that for specific directories only) and 2) not include an index file. If on the other hand you actually want to prevent your visitors from directly browsing a directory (for instance if there are files in it that you do not necessarily want them to see, amybe because they're no longer up to date), you have two options: The first option is to 1) configure the web server to serve up a default file when the browser asks for a directory; the name of the default file could be "index.html" or "default.asp" or any of a number of conventional names, but this is not required: you could name the default "ktinkel.duh" if you prefer ; generally you can name a list of possible defaults; and 2) actually include in your directory a file with a name that matches one of your list of defaults.When the browser now requests a directory for which a default is set, it will go along its list of default names for index files and serve the first one it finds with a matching name. But what if there is no file with a matching name in a requested directory? That's where the second option comes into play: you can also configure the web server to not allow directory browsing. If a browser then requests a directory and no matching default file is defined and directory browsing is not permitted, the server will send back a "403 Forbidden" response. You can combine these tactics by 1) allowing directories to be browsed and 2) defining default index files. Then, in any directory where no matching index file is found, the server will show a browsable directory listing. The function of a web server is merely to "serve resources" - and a directory is a resource, too, not just files; there's no requirement for there to be any HTML document (static or dynamic) at all, so it's perfectly valid to not even have an index at root level. Clear as mud? __________________ Marjolein Katsma Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog |
|
|
|
|
|
|
#3 | |
|
Founding Sysop
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
|
Quote:
![]() I know that I do not need an index file technically (I used to just throw stuff up on the server, loose, and it worked). But it wasn’t easy to manage, and I really do not want people to be able to poke around too much. Which I guess gives me my answer. It’s mainly that I get confused when I have a bunch of files called index.html, each, of course, with a different path. So I was looking for a shortcut, but guess there really isn’t one unless I get into fancy high-tech php stuff, for which I am a lousy candidate! Thanks. __________________ :: |
|
|
|
|
|
|
#4 |
|
Staff
Join Date: Oct 2004
Posts: 6,619
|
My website has multiple "index.html"--one at root and one for each "subdivision" (for lack of a better term)...each of the following has its own "index.html" which is coded specifically for that section--basically, I just save the most current "edition" of that section as "index.html"
My home page tlbimages pages (multiple pages) tlbimages cards (multiple pages) ltlimages page links page I also have a custom 404 for those nonexistent pages... I don't allow access to my directories... Not sure if this helps you or not... Terrie |
|
|
|
|
|
#5 | |
|
Founding Sysop
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
|
Quote:
Thanks. It is helpful to know that I am not being a total doofus. This time. <g> __________________ :: |
|
|
|
|
|
|
#6 |
|
Member
Join Date: Dec 2004
Location: In the heart of Lake Minnetonka
Posts: 337
|
And, FWIW, I generally toss in a zero-length index.html just to make certain that the directory is not inadvertently browsable.
It takes less bandwidth to send a zero-length index.html than to send a 404 or 403 message. Note that this is particularly for directories that are not intended to be browsed. |
|
|
|
|
|
#7 | |
|
Founding Sysop
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
|
Quote:
Part of my problem is that I was using the various sub-directory index.html files as tables of contents. I was constantly having to update them. But if I used your trick, I could have a single TOC (or index in the conventional sense) and not have to keep track of all the separate sections. Now I have to figure out if that will work. __________________ :: |
|
|
|
|
|
|
#8 | |||
|
Member
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
|
Quote:
Quote:
But you could equally have a complete TOC (site map!) for your site and have that automated as well. Or both, of course.
__________________ Marjolein Katsma Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog |
|||
|
|
|
|
|
#9 | ||
|
Founding Sysop
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
|
Quote:
Quote:
__________________ :: |
||
|
|
|
|
|
#10 | |
|
Member
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
|
Quote:
__________________ Marjolein Katsma Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto Index of names??? | kazik | General Publishing Topics | 1 | 01-29-2007 01:12 PM |
| XLS to HTML | dthomsen8 | Web Site Building & Maintenance | 3 | 08-07-2006 03:53 PM |
| If you like HTML even a little... | iamback | Web Design | 0 | 06-09-2006 12:15 AM |
| Index of PDF Content | RJ Emery | General Publishing Topics | 9 | 01-21-2006 11:42 AM |
| Mac HTML/CSS editor | ktinkel | Web Site Building & Maintenance | 0 | 08-23-2005 11:32 AM |