views:

251

answers:

8

I've used both index.html and default.html in the past for home pages on sites I've built. These days I mostly use index.html, but I'm not sure why... consistency I suppose.

I'm pretty sure IIS handle them the same, but I am wondering, though, if there's any benefit or pitfall in using one over the other, or are they treated the same in all respects?

Thanks!

+17  A: 

index is traditional, and more servers are configured to look for it than for default.

David Dorward
@David - Thanks for that. I'm sure you're right, but have you a source to support this?
Galwegian
That's from experience, but the upvotes suggest a lot of people agree.
David Dorward
@Galwegian, all web servers I've heard of are configured by default to look for index.html. IIS is the only one I know of that will also look for default.html - that's where it's mainly used. It don't matter which one you use as long as you tell the web server to look for the right file.
iconiK
originally it was index.html on apache etc and default.htm (note the missing l) on IIS. Microsoft wanted to do everything differently back then
seanizer
@seanizer, by "back then" you imply that they wish to conform to standards now, which I'd say is hardly the case.
Michael Aaron Safyan
@michael: well it's somewhat less the case now than it was back then, but no: ms is not famous for embracing standards
seanizer
+2  A: 

It is recommended to stick with either index.html or index.htm in most cases, default.html is generally used on a windows environment, i.e IIS, so you may come unstuck if you moved to Apache. Saying that you could get around this issue using a .htaccess file for Apache to use default.html as the default file location.

simnom
Actually, ".htm" really isn't all that common... on UNIX the file extension can be as long as you want, and so on UNIX systems (where Apache typically runs), the ".html" extension is more common.
Michael Aaron Safyan
+1  A: 

In IIS you can set the file(s) to look for when the url points to a folder.

You can specify multiple files. And they are tried in order to see if they exist.

If your site is under heavy load, and you have a index.html, but default.html is in the list before index.html, you might have a slight decrease in performance.

So normally it does not matter.

GvS
This is true on IIS and Apache. (as well as most other web servers.)
Matthew Whited
+2  A: 

I prefer index.html (I think this is typically more popular), but that said it doesn't matter, because users should never know the name of the file from which they are being served!!!. If you are giving users links such as http://path/to/some/name_of_entity.html, then you are doing things wrong! Links should be clean and look like http://path/to/some/name_of_entity/. Use rewriting rules (if necessary) to, behind the scenes, serve the request using a specific page (e.g. to make http://path/to/some/entity/ serve from http://path/to/cgi-bin/entities.pl?name=blah without the user seeing the actual resource or extension). The name of the actual page is an implementation detail that no one should ever know about, and by hiding this implementation, it gives you the freedom to switch between index.html, default.html, index.php, index.jsp, and any other underlying implementation. This allows your pages to evolve and change their implementation without invalidating your URLs, and since invalidating URLs weakens the rank of your pages, it is a really good idea to set up a URL scheme that can survive changes to your website for SEO purposes.

See also:

Michael Aaron Safyan
I disagree, look at your address bar for this page. Stack uses MVC, which lets you easily do what you're suggesting, but most other technologies don't. Try linking a news article without showing them the file name. http://news.bbc.co.uk/1/hi/science_and_environment/10313173.stm
SLC
@SLC, StackOverflow does use REST. Do you see any file extensions in the URL? I don't think so. The file extension is completely hidden, and the website is structured in the form of hierarchical data. And the example from BBC is exactly how one shouldn't do it.
Michael Aaron Safyan
Because I disagree with "users should never know the name of the file from which they are being served". I was wrong about stack I misread -html as .html but that's because it uses MVC as I explained. Look at other sites that don't.
SLC
@SLC, downvoting is for an incorrect answer, not for disagreement. You still haven't given good reason for the downvote, and your statement about StackOverflow was incorrect.
Michael Aaron Safyan
@SLC, also the "-html" is there because the question has "html" in its title... look at any other question that does not have "html" in the question, and you won't see "html" in the URL at all.
Michael Aaron Safyan
@Michael - Thanks for your reply. I'm interested in why a user should never see the name of the file they are being served? Any info. you could supply would be great.
Galwegian
@Galwegian, the actual name of the file including its file extension is an implementation detail. Suppose in a year you want to make it more interactive, and so you change it to ".php", then all your old links with a ".html" extension are no longer valid. And then suppose a year after that, you decide to switch to Java and so you change it to ".jsp", again invalidating your ".php" links. This means your URLs are not permanent, which makes it harder to find your links. It also weakens the page rank of your page (which harms how much search engines like your page)...
Michael Aaron Safyan
... in general, though, implementation details should never be exposed as it constrains you to that particular implementation. It is true of URLs and it is also true of APIs and programming in general. One should generally follow the principle of exposing the least amount possible, which gives you the greatest freedom to change the details underneath.
Michael Aaron Safyan
@Michael, thanks for clearing that up. I had misunderstood what you were advocating hiding from the user.
Galwegian
@Michael: It could also be debated that changing from .html to .php would be a change in resource so the links should require an update. You could also implement it a different way that forwards the .html to the .php. (I did similar when I changed my blog from using wordpress to blog engine. I created a PHP page that did a lookup based on the wordpress ID values from a data table and the redirects this to the new "real" .ASPX slug.
Matthew Whited
Also, down votes are for what ever people use them for. Though it is nice when people leave a related comment.
Matthew Whited
@Michael: I disagree. Filename is an essential part of URL. Hiding information is generally a bad idea. Using tricks to muddle up the navigation is especially bad idea. Among other things, it makes it impossible to use the pages off-line. Generally, it is best to keep things simple. P.S. Your answer is not an answer, it is an opinion.
PauliL
@PauliL, this structure is used by every single Web 2.0 website. In addition, it is an answer; I stated that it doesn't matter (you can use whatever name you want as the default page, provided that your webserve is configured accordingly), but that, moreover, the filename should not be exposed and, indeed, it shouldn't be.
Michael Aaron Safyan
@Matthew, the redirect you suggest is merely a hack to preserve the old URLs and it ultimately leads to a longer page loading time, which is detrimental to the user. The extension of the page doesn't matter; if it is logically the same, then it should have the same URL.
Michael Aaron Safyan
Again, that is up for debate on how it should work. And the redirect could be something like a 302 on the server side to keep the time delay very short.
Matthew Whited
BTW... I use a restful service to retrive photographs for a gallery and as PauliL pointed out it causes some minor issues when trying to use standard client side features to save the content offline (yes I know I can change header information. But if I was hosting the file names that wouldn't be an issue.)
Matthew Whited
kemp
A: 

It's all about consistency, since today you work with a IIS server, and tomorrow you may be with an APACHE server that will be looking for index.html/index.htm/index.php!

So, if you use a consistent method, you'll have no problem changing server's... if you don't, you'll be always facing additional configuration issues...

This is applied not only to this topic, but to many coding issues! A consistent method is always the way to go :)

Zuul
A: 

default.html is the default page for the requesting location if no specific page is specified. ex: http://myname.com/place/ will load default.html in /place folder.

index.html is used as listing page that displays index of all available resources.

Now a days this difference is eliminated and it is hardly evident anywhere. Its now just a preference of the webmaster to decide index.html or default.html as default load.

this. __curious_geek
Where are you quoting that from? I can't find the phrase anywhere on Google.
David Dorward
Does it really need to be google-indexed to be acceptable ?
this. __curious_geek
@this. __curious_geek, index.html is used as the default web page to load in all web servers I've heard of, if no specific page is requested. IIS is the only one I've seen to use default.html as well. Probably that was the original purpose of index.html, but it's hardly valid today.
iconiK
+4  A: 

The choice of the first page is absolutely yours. Few servers are configured to run for Default.html and few to Index.html. You can change these in the configuration files. For consistency purposes, use index.html. Most of the servers recognise it.

Ricardo Slafford
A: 

Although I prefer to use index.html myself (mostly because I'm more of an apache than an iis user) , I have to say that on the semantic level, default.html makes more sense.

index.html originates from a time when you could strip the page name from almost every web page there was and get a directory listing. The index.html provided an alternative way to display this directory listing. So basically: the user looks inside a folder and index.html is what he sees

default.html uses a different abstraction: the user has not specified which resource inside a certain path he wants to see, so I show him my default resource

So while one could argue that index.html is the more restful version, default.html is the service oriented version.

Of course, this is only relevant on the semantic level, on the technical level it makes no difference, all webservers in existence should be able to cope with both if properly configured.

seanizer