Forum Moderators: open
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
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.
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?
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.