Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Alex Watts
Alex Watts
8,396 Points

Why index?

Hello,

I was wondering why my first HTML document has to be called 'index.html'. Is there any history or meaning behind this.

Thanks.

Paul Yabsley
Paul Yabsley
46,713 Points

It doesn't necessarily but many web servers will look for an index.html file and display that by default. It is worth noting server software can also display different files by default including different file types such as .php. There is usually a setting to tell a server to use a different file. All that depends on the type of server.

I'm not sure about the history behind the name index but my understanding is that in the early days of the web the index was the 'home' page as it 'indexed' or listed the other linked pages/documents.

3 Answers

Alex Watts
Alex Watts
8,396 Points

Thanks Paul,

I started a project with 'home.html' and my browser did not like it.

Paul Yabsley
Paul Yabsley
46,713 Points

If you have a file called home.html and you open it in a browser, then that should work. If you go to a directory address in your browser without specifying a document then it will look for index.html.

Alex Watts
Alex Watts
8,396 Points

I am using Brackets.io to preview my webpage live, as if it were on a server.