A URL (uniform resource locator) is the address of one resource on the web. It has parts, and you should be able to name each one: protocol, domain (host name) and path. These questions appear in security and web topics, and the same skill helps you spot fake links.
This lesson opens the internet security and responsible use module.
How is a URL built?
Take this fictional address:
https://www.learn.example.com/maths/fractions.html
| Part | Value | What it does |
|---|---|---|
| Protocol | https | The set of rules used to fetch the page. HTTPS adds encryption. |
| Host name | www.learn.example.com | Which server to contact. |
| Path | /maths/fractions.html | Which folder and file on that server. |
The characters :// separate the protocol from the host name. The first single / after the host name starts the path.
How do I find the domain?
Read the host name from the right. The last label, .com, is the ending (the TLD).
The label just before it, example, is the name registered by an owner.
Together, example.com is the registered domain.
The labels to the left, learn and www, are subdomains.
The owner of example.com can create any of these freely. In Malaysia you may see endings such as .com.my. There the registered domain is example.com.my, because .com.my works as the ending.
Worked example
Identify the protocol, host name, domain and path in:
https://shop.cityfood.example.org/menu/drinks/tea.html
Step 1, protocol: the text before :// is https.
Step 2, host name: the text between :// and the next / is shop.cityfood.example.org.
Step 3, domain: read from the right. .org is the ending, example is the registered name, so the domain is example.org. The labels cityfood and shop are subdomains.
Step 4, path: everything from the first / after the host name is /menu/drinks/tea.html. The folder is /menu/drinks/ and the file is tea.html.
The mistake to watch for
Mistaken reading: In
https://www.example.com.verify-login.example.net/, the domain isexample.com.The student read from the left and stopped at the first familiar word.
The host name is www.example.com.verify-login.example.net. Reading from the right, the ending is .net, the registered name is example, so the domain is example.net. The text example.com is only a set of subdomain labels chosen by the owner of example.net.
Always find the first single /, then read the host name backwards from that point.
Check yourself
1. Give the protocol and the path in http://www.school.example.edu/timetable/form4.pdf.
Show answer
Protocol: http. Path: /timetable/form4.pdf. (The host name is www.school.example.edu.)
2. What is the domain in https://pay.cafe.example.com/order/12?
Show answer
Reading from the right, the ending is .com and the registered name is example. The domain is example.com. The labels pay and cafe are subdomains.
3. Two links are https://example.com/news/a.html and https://example.com/news/b.html. What is the same and what is different?
Show answer
The protocol, domain and folder are the same. Only the file name in the path differs (a.html and b.html), so they are two different pages on the same website.
Where does this lead next?
Next, see how a browser uses these parts in a browser-server interaction.
The same reading skill is used to spot phishing signals. Then test yourself with the mixed practice set. The restricted pseudocode trace trainer helps with the tracing questions later in the module.
If you keep losing marks on labels that are nearly right, that is something we work on in online one-to-one Computer Science tuition.