Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do people name their files index.html?

Tags:

html

I have seen a lot of people been using that file name for their HTML files. I wonder why? I'm kind of new to HTML, I haven't learned much, but when I name my HTML files, I name them whatever I want. When I have been searching up examples of HTML, I have found they name it index.html. Why?

like image 872
Henrik Berg Avatar asked Feb 09 '23 03:02

Henrik Berg


1 Answers

I have seen a lot of people been using that file name for their HTML files

You would typically use that name for one of your page, and it would usually be the home page.

When you arrive a website, for example www.website.com, you're not pointing to a file (like you would be if you typed www.website.com/about.html), you're pointing to a directory listing of all the files.

The webserver will try to serve a file, typically called index.html or index.php by default, but it could be something different, and it's configurable by editing your webserver's config files.

If the server doesn't find any file to serve (because you didn't include an index.html file or because you renamed it without editing the server's config) you will see a listing of the files, which is rarely the desired behavior, especially at the root of a website.

like image 116
Drown Avatar answered Feb 11 '23 23:02

Drown