Unit 1 · How the web works
Why a link without https:// gives a 404
Without a scheme, the browser reads www.example.com as a relative path: a file of that name next to the current page. It asks your own server for it and gets a 404. Start links to other sites with https://.
The mix-up
What people often think
“A link to www.example.com works without https://.”
What the tutor says
Without https://, the browser treats www.example.com as a file in your folder and gets a 404. Start outside links with https://.
How it works
The browser has to decide whether an href points somewhere else or somewhere on this site. https:// is the signal that it is a full address on another server. Anything else is measured from the current page.
That rule also works in your favour. For pages on your own site, a relative path like menu.html is shorter than the full address and still works if the domain changes.
Side by side
<a href="www.example.com">Our supplier</a><a href="https://www.example.com">Our supplier</a>
<a href="menu.html">See the menu</a>Close cousins of this mix-up
The tutor watches for these in the same lesson.
“Every link needs the full web address.”
For pages on the same site, a relative path like menu.html is shorter and still works if the domain changes.
Practise it with a tutor watching
Reading a request
Read a request and its response line by line, and write links that work.
Free with an account. The first two units need no account.