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 How to Make a Website Beginning HTML and CSS Follow Along with Workspaces

hamza shaikh
hamza shaikh
5,875 Points

why is it important that we name the main file index.html ?

will it not work the same if i name it something else

2 Answers

Steven Parker
Steven Parker
229,732 Points

When a connection is made to a web site without specifying a specific file in the URL, most servers return a default page. This page is known as the "landing page" and most servers will provide by default a file named "index.html" Thus, a connection made to "http://mysite.com" turns into "http://mysite.com/index.html".

Generally, a server can be configured to use a different file file as a landing page if desired, but "index.html" is the most common and typically the name used unless the developer or administrator has a reason to configure the server otherwise.

I'll include an addition to this comment. There are three (3) default page known by most web servers, they are index.html and index.htm that already well-known, and also default.htm on some windows servers. As long as you use one of those three names, that will be considered as your main page.

Simon Sørensen
Simon Sørensen
17,304 Points

Because that's the file name the server sees as an index file.