two main conceptual beginner questions that I have here.
1) I noticed that index.html always happens to stand alone in the root directory. Will index.html always be located in the root directory? Will it always appear as a stand-alone (not within a folder) in the root directory? Can other stand-alone files appear along side with index.html in the root directory?
2) I thought the term root relative meant mapping out the location of the file you’re after, starting from the root directory, but for some reason on our desktop the root directory changed to C:? Why? Because as stated before, I thought the term root directory simply meant starting from the project folder name for the website you’re building. I keep assuming that root refers to the file structure of our website, starting from the project’s folder name?
From the perspective of a client, they couldn't care less about index.html. Clients in fact don't usually request index.html. When a client visits your host, it requests whatever it wants, usually /
. The web server is in charge of producing a valid-looking html response to this request (/
).
A static web server usually looks at its working directory (that you set up for it), see if there's an index.html in it, and returns that to the client. The choice of name, index.html, is by convention. The requirement that it locates directly in the root folder, is also by convention. A web server author can just as easily write the server in such a way that when user requests /
, instead of simply serving an index.html from the root folder, it searches the entire folder recursively and find the first index.html and serve that. If you are using such a server, you can put your index.html in a folder. You see, where you should put your index.html is entirely dependent on the server implementation and how you set it up.