Forum Moderators: open

Message Too Old, No Replies

Does a sub directory of articles on site need an index.html file?

Is it good practice to provide an index file for each sub directory site?

         

zollerwagner

8:50 am on Jan 30, 2005 (gmt 0)

10+ Year Member



Is it good practice to provide an index file for each sub directory of a site?

I have the pages of a site organized into directories for ease of management.

In the case of one directory, it doesn't make sense to have an index page. Should I put an index.html file in that directory, even if no other page will link to the index?

I'll tell you why I ask. I noticed that every directory in the phpBB bulletin board software has it's own index.htm file. Directories for images and css and the like wouldn't seem to need an index, but phpBB has them. Why?

The only reason I came up with was that adding indexes might be security measure in the event that an end user hadn't turned the "indexes" off in their .htaccess file. with the statement:
Options -Indexes

lammert

2:42 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It depends on the type of subdirectory if you need an index.html/index.htm/index.php. If you do not want to allow people to look directly at the available files, having an index.html is a good idea. I use this for most of my /picture directories. I don't want people to look in the directory to copy all pictures at once, but I do want to show a friendly message to them, not just a 403 or 404 error.

In content directories it is also useful to have an index.html with content. This could be a sort of directory listing for the other content files in the directory. In the past I didn't have an index.html in some of my subdirectories. The index files was named www.example.com/subdir/subdir.html instead of www.example.com/subdir/index.html. I discovered from my logfiles that many users actually typed www.example.com/subdir/ to jump to the index page of the directory. They received an error message, which was clearly not what I wanted. Therefore I rename index files to index.html.

zollerwagner

8:39 pm on Jan 30, 2005 (gmt 0)

10+ Year Member



Interesting response, and not at all what I expected to hear.

What kind of website is this and what does your index file usually say?

I'm curious about why you want people to be able to see what's in a directory. I've generally wanted to keep by "backroom" off limits, force them to go through the site map or the usual navigation to find things.

In part, that's because I've assumed that only those who are up to no good would be knowledgeable enough to look for an index file. But, on some sites where a page is missing, I'll try opening at the directory level, too. Is that what you had in mind?

lammert

8:59 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe I didn't make it clear enough. I do not provide a plain directory listing of the HTML files. I don't like that people see that. There is sometimes stuff stored which is not ment for everybodies eyes. Instead, suppose that I have files like red-widget.html, blue-widget.html etc in the directory /widgets/

Now my index.html in that directory contains something like:

<dl>
<dt><a href="red-widget.html">Red Widgets</a>
<dd>Red widgets are blablabla...
<dt><a href="blue-widget.html">Blue Widgets</a>
<dd>Blue widgets can be used for...
...
</dl>

You can then link this index file in your sitemap - if you have one - which makes it easy for both robots and users to navigate your website. If you have a very large site your sitemap will also get smaller and easier to read by people, as there is no need to link to every single file. Only the index files in the directory structure are mentioned in the sitemap.

So you could more or less see my use of the index.html files in my directory as subpages of the sitemap.

zollerwagner

9:07 am on Jan 31, 2005 (gmt 0)

10+ Year Member



I like that idea about using the indexes to simplify the site directory. Good idea.

What do your index files in the image directories say?