DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Reply
 
Thread Tools Display Modes
Old 12-05-2005, 07:54 AM   #1
ktinkel
Founding Sysop
 
ktinkel's Avatar
 
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
Default Directories & index.html files

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.)

   
__________________
::
ktinkel is offline   Reply With Quote
Old 12-05-2005, 11:13 AM   #2
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by ktinkel
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.)
A directory is a directory - and the one at the root is one as well. "index.html" is not required anywhere (including the root); whether you "need" one anywhere depends on what service you want to offer your visitors.

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
iamback is offline   Reply With Quote
Old 12-05-2005, 12:17 PM   #3
ktinkel
Founding Sysop
 
ktinkel's Avatar
 
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
Default

Quote:
Originally Posted by iamback
A directory is a directory - and the one at the root is one as well. "index.html" is not required anywhere (including the root); whether you "need" one anywhere depends on what service you want to offer your visitors.… Clear as mud?
Oh, a little better than that.

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.

   
__________________
::
ktinkel is offline   Reply With Quote
Old 12-05-2005, 12:53 PM   #4
terrie
Staff
 
Join Date: Oct 2004
Posts: 6,619
Default

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
terrie is offline   Reply With Quote
Old 12-05-2005, 01:47 PM   #5
ktinkel
Founding Sysop
 
ktinkel's Avatar
 
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
Default

Quote:
Originally Posted by terrie
My website has multiple "index.html"--one at root and one for each "subdivision" …

I also have a custom 404 for those nonexistent pages...

I don't allow access to my directories...
That is what I have been doing, more or less. (Well, I do not have custom 404 pages; have been meaning to do that ever since you described how you did it, but time eludes me. Or I forgot.)

Thanks. It is helpful to know that I am not being a total doofus. This time. <g>

   
__________________
::
ktinkel is offline   Reply With Quote
Old 12-06-2005, 08:15 AM   #6
gary
Member
 
Join Date: Dec 2004
Location: In the heart of Lake Minnetonka
Posts: 337
Default

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.
gary is offline   Reply With Quote
Old 12-06-2005, 10:11 AM   #7
ktinkel
Founding Sysop
 
ktinkel's Avatar
 
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
Default

Quote:
Originally Posted by gary
And, FWIW, I generally toss in a zero-length index.html just to make certain that the directory is not inadvertently browsable.
That is clever. Thanks.

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.

   
__________________
::
ktinkel is offline   Reply With Quote
Old 12-06-2005, 10:52 AM   #8
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by ktinkel
Quote:
Originally Posted by gary
And, FWIW, I generally toss in a zero-length index.html just to make certain that the directory is not inadvertently browsable.
That is clever. Thanks.
Clever indeed - but necessary only if you cannot configure the web server to not allow the directory to be browsed. On Apache servers (at least) - even hosted servers - this is usually possible though.

Quote:
Originally Posted by ktinkel
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.
A simple PHP script could automate for you having the index.html file serve as a table of contents, and keep the "index" file for what it was originally intended for. 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
iamback is offline   Reply With Quote
Old 12-06-2005, 10:59 AM   #9
ktinkel
Founding Sysop
 
ktinkel's Avatar
 
Join Date: Oct 2004
Location: In Connecticut, on the Housatonic River near its mouth at Long Island Sound.
Posts: 11,202
Default

Quote:
Originally Posted by iamback
Clever indeed - but necessary only if you cannot configure the web server to not allow the directory to be browsed. On Apache servers (at least) - even hosted servers - this is usually possible though.
I make a point of finding hosts with Apache servers, so I could look into that. Although Gary’s trick is not difficult.

Quote:
Originally Posted by iamback
A simple PHP script …
You used “simple” and “PHP” in the same phrase. Unfortunately, I am a PHP-o-phobe (or just a PHP dunce, maybe). I would love to be able to use it for precisely the purpose you mention, but have not got far enough into the PHP book to see how to do it.

   
__________________
::
ktinkel is offline   Reply With Quote
Old 12-06-2005, 11:15 AM   #10
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by ktinkel
You used “simple” and “PHP” in the same phrase. Unfortunately, I am a PHP-o-phobe (or just a PHP dunce, maybe). I would love to be able to use it for precisely the purpose you mention, but have not got far enough into the PHP book to see how to do it.
I mentioned "simple" specifically to not scare you off - it's simple to have PHP even if it's not as simple to write it as it is to use it. You could get someone to write it for you though, and then (if and when you feel so inclined) you could study the code. Or just leave it doing its job for you.

   
__________________
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
iamback is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -8. The time now is 11:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Contents copyright 2004–2012 Desktop Publishing Forum and its members.