Unit 1 linking pages


#1

Hi.

So I linked my aboutme.html page to my index.html page so I can go to the aboutme.html page from index.html.

Why is it that I can type “<a href=”/"" (typed incorrectly here so it doesn’t hyperlink the following text) and be redirected back to index.html? Does it redirect you to the first file in the folder or is the first name of the main file of a html folder called index?


#2

An index.html file will always be at the root of a directory.

e.g.

https://www.yourawesomesite.com/aboutme/index.html
https://www.yourawesomesite.com/aboutme/

are the same thing. A root folder or directory will always assume it’ll find an index.html file. If it doesn’t, and your server isn’t properly configured, it will show all content inside of that directory.

This needs an index.html
directory


#3

So if it’s not configured properly it’ll show that image? The image “index of /” showing all the other files inside the root folder?

So index.html is the base file (root file) of the directory? Also typing / is the same as typing index.html because / directs you to the root file?


#4

That is correct.

You’ll want to make sure to always have an index.html at the root, if you want to avoid showing all your files to your visitors. This could be a serious security issue, should you have any sensitive data or files that shouldn’t be accessible that easily. But you can find out more about all of this later on.

If you’re currently on aboutme.html, and have a link <a href="/">Go to index!</a> , it’ll bring you to the index.html page.


#5

Thank you very much.

:slight_smile:


#6

Can it be called “Index.html” with an uppercase i or does it have to be lowercase?


#7

Lowercase, always name your files in lowercase.


#8

If it’s saved as Index will it still be considered the root file?


#9

Depending on how your server is set up, file names can be case-sensitive. You could end up having an index.html and Index.html, and you simply don’t want that. As a general rule, always use lowercase. URLs are lowercase anyway, and that’s the example to apply and follow.


#10

Got it. Thank you.

:slight_smile:


#11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.