Skip to content
IGCSE·Tuition
Computer Science · Lesson

Distinguish a URL domain and path

A web address looks like one long word until a question asks which part names the owner.

On this page
  1. How is a URL built?
  2. How do I find the domain?
  3. Worked example
  4. The mistake to watch for
  5. Check yourself
  6. Where does this lead next?

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

PartValueWhat it does
ProtocolhttpsThe set of rules used to fetch the page. HTTPS adds encryption.
Host namewww.learn.example.comWhich server to contact.
Path/maths/fractions.htmlWhich 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 is example.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.

Questions people ask

What is the difference between a domain and a path?

The domain names the organisation or owner of the website, such as example.com. The path names a particular resource on that site, such as /maths/fractions.html. Two pages on the same site share the same domain but have different paths.

Is www part of the domain?

The www label is a subdomain chosen by the site owner, conventionally for the web service. The registered domain is the part to its right, such as example.com. Exam answers usually accept the full host name as the domain name, but follow the wording in the question.

Why does the end of the host name matter most?

Host names are read from right to left in importance. The label next to the ending (TLD), such as .com or .net, identifies the owner. Anything further left is chosen by that owner, so it can be any text at all, including a trusted-looking brand word.

What does the part after a question mark mean?

It is a query string, extra data sent to the page, such as ?item=42. It is separate from the path. Questions at this level usually ask for protocol, domain and path, so check what the question asks you to identify.

Updated:

Your next step

If URL questions cost you marks because your labels are almost right, a one-to-one teacher can check each of your answers against exact mark-scheme wording until the habit sticks.

Paid one-hour trial at your assigned teacher’s confirmed rate, starting from RM80.

Tuition is arranged with a parent or guardian. Send them this page on WhatsApp and they can enquire for you.

Parents: enquire here

  • 9,000+ students helped through our service
  • 9+ years helping IGCSE students