How to read a URL
A URL has five parts (protocol, domain name, port, path and query string), and each one tells the web server something about the request.
Novice · Web Development · Updated
A web address is a URL (Uniform Resource Locator). The URL of a web page consists of different parts, each of which is an important piece of communication with the web server.

- Protocol: how the request is sent (
httpsmeans it is encrypted) - Domain name: the address of the server where the website is hosted
- Port: the port (extension) of the web application on the server
- Path: the path to the requested resource. It may be a real folder structure or a virtual path
- Query string: extra information sent with the request, usually search values. It starts after the
?
Do it: put the bookshop's addresses together
The Corner Bookshop's new website is being built. The owner has sent the parts of three addresses the home page should link to, and each one needs to become a whole URL in a link.
The parts join in this order:
| Part | How it's written | Example |
|---|---|---|
| Protocol | The protocol, then :// |
https:// |
| Domain name | As it is | cornerbooks.com |
| Port (only when there is one) | :, then the port |
:8080 |
| Path | Starts with / |
/search |
| Query string (only when there is one) | ?, then the query string |
?genre=mystery |
The three links:
| Link text | Protocol | Domain name | Port | Path | Query string |
|---|---|---|---|---|---|
| Home | https | cornerbooks.com | none | /index.html | none |
| Test site | http | localhost | 8080 | /index.html | none |
| Mystery books | https | cornerbooks.com | none | /search | genre=mystery |
For example, the Mystery books parts join like this: https:// + cornerbooks.com + /search + ?genre=mystery = https://cornerbooks.com/search?genre=mystery. It has no port, so nothing goes between the domain name and the path. Its link is:
<a href="https://cornerbooks.com/search?genre=mystery">Mystery books</a>
Your job: under the heading, write the three links.
- One
<a>for each row of the table: Home, Test site and Mystery books. - Each link's
hrefis its whole URL, its parts joined in the order above. - Each link's text, between its tags, is the link text from the table.
Practiced live on the lesson page: write the HTML right there and check it.