I’m taking a backend course that just started today, and everything in that field is new to me. Our teacher told us "home.html" was the first file the server targeted when someone entered our website. That home.html was like index.html, but for the back end (meaning index.html was for the frontend) I guess my final question is, is that correct? Is there a difference between index.html and home.html?
I searched "home.html" , "index.html vs home.html", define "home.html", "home" +".html", backend "home.html" etc. But I didn’t get a definitive answer. The only information I got (that confused me even more) is that it’s preferred to name our homepage index.html over home.html.
3
Answers
As far as I know, there are no differences in naming your file
home.html
orindex.html
. They’re just names for an HTML file, however, it is true that it’s the first thing someone sees in the frontend when entering a webpage.Many webservers, such as Apache and Nginx have a convention that if you request a URL that maps to a directory on the server, they will look for a file called
index.html
and serve that if it exists.This is configurable and the web browser is completely unaware this is happening.
Usually this is configured to look for
index.html
. It’s possible that there were webservers that defaulted tohome.html
, but I’m not aware of it.Neither are these are standard, it’s just a convention and doesn’t apply for many application-style webservers like Node. For Node, there’s not by default a correlation between a URL path and a filesystem path.
Similarly the convention for PHP sites was to look for
index.php
instead if a URL was hit that maps to a directory.So if your teacher told you exactly as you’ve written it, I would guess that your teacher doesn’t fully understand this. However, something might have been lost in translation.
I think the only difference is that index.html is usually the default landing page, meaning that when a user go to http://www.yourwebsite.com without adding /home.html or /index.html (or anything), they will be directed to http://www.yourwebsite.com/index.html