index.html files (Re: [Techtalk] Resolving a doman name)

Mary mary-linuxchix at puzzling.org
Fri Jan 21 09:41:11 EST 2005


On Thu, Jan 20, 2005, Kai MacTane wrote:
> 
> A couple of notes, to add to what Mary said: if the web server is properly 
> configured, you can just use:
> 
> GET / HTTP/1.0
> 
> instead of "GET /index.html HTTP/1.0". (Indeed, if "GET / HTTP/1.0" 
> produces an error, you've got something going wrong in your configuration.)

Yeah, if you're going to want to address your website files by name,
there's no real need to call them index.html. index.html is a
(configurable, almost always on by default) convention
for the webserver -- when I'm asked for a *directory*, I will instead
return the contents of the file in the directory called "index.html".

I tend to like avoiding links to them, you can generally do:
href="http://example.com/" instead of href="http://example.com/index.html"
href="/" instead of href="/index.html" (that's a relative link to the
root of your own domain)
href="./" instead of href="index.html" (that's a relative link to the
directory you're in)

The reason I like to do this is that the fact that the base file is
stored in index.html is an implementation detail. One day you might want
to store it in index.php. One day your whole site might be managed by a
single script. It's easier to never expose index.html than to try and
support it later when you're not using HTML files at all. (Extensions on
web file names are also implementation details, and some people turn
them off too.)

-Mary


More information about the Techtalk mailing list