Unit 1 · How the web works
What the ?query part of a URL does
The query string, everything from ? up to any #, travels to the server with the path. It does not name a new page; it passes options, such as how to sort a list.
The mix-up
What people often think
“The ?sort=price part is the name of a page.”
What the tutor says
The page is still /menu/bread. The query adds options, here telling the server how to order the list.
How it works
Take https://cornerbakery.ca/menu/bread?sort=price#reviews. The scheme is https://, the domain is cornerbakery.ca and it ends at .ca. The path /menu/bread names the page. ?sort=price asks the server for that page sorted by price. #reviews stays in the browser.
A query is not tracking junk the server ignores. Search boxes, filters and page numbers all ride in the query, and the server reads them to build the right response. Several options are joined with &, as in ?sort=price&page=2.
Close cousins of this mix-up
The tutor watches for these in the same lesson.
“The ? part is tracking junk the server ignores.”
The query is sent to the server with the path. Here it asks for the menu sorted by price.
“Everything after the dot is part of the website's name.”
The name ends at .ca. The first slash starts the path, which names a page on that server.
Practise it with a tutor watching
Parts of a URL
Name each part of a URL and say which parts reach the server.
Free, no account needed.