Uniform Resource Locator (URL)
1. Definition
A URL (Uniform Resource Locator) is the address of a resource on the Internet — it tells the browser which protocol to use, which server to contact and which resource to fetch. Every hyperlink, bookmark, image and API call is identified by a URL. Written in a standard form defined by the IETF (RFC 3986 family), a URL is a subset of a URI (Uniform Resource Identifier): a URI identifies a resource, while a URL also says how to get it.
scheme authority (host + port) path query fragment
│ │ │ │ │
https://www.pyqdeck.com:443/papers/cse-sem1?year=2024&subject=100108#notes
2. Components in Detail
| Component | Meaning | Example from the URL above |
|---|---|---|
| Scheme (protocol) | How to access the resource | https (also http, ftp, file, mailto, tel, ssh, ws, data) |
| Userinfo (optional) | Credentials, rarely used and insecure | user:pass@ |
| Host / domain | Server name (resolved by DNS) — may be a domain or an IP | www.pyqdeck.com |
| Port (optional) | TCP port; defaults are implied (80 for HTTP, 443 for HTTPS) | :443 |
| Path | Hierarchical location of the resource on the server | /papers/cse-sem1 |
| Query string | Key=value parameters sent to the server, separated by & |
?year=2024&subject=100108 |
| Fragment (anchor) | Points to a place inside the page; handled by the browser, not sent to the server | #notes |
3. Rules, Encoding and Limits
- Percent-encoding — characters not allowed in a URL (space,
#,&, Devanagari, etc.) are written as%plus two hex digits: a space becomes%20, and a blank search for "engineering maths" becomes?q=engineering%20maths. - Reserved characters (
/ : ? # [ ] @ ! $ & ' ( ) * + , ; =) have special meanings and must be encoded when they are part of data. - Case sensitivity — the host/domain part is case-insensitive (
WWW.PYQDECK.COMworks), but the path and query are case-sensitive on most servers. - Internationalised domain names (IDN) — non-ASCII domain names are converted to Punycode:
भारत.inbecomesxn--h2brj9c.in. - Length — the practical limit is a few thousand characters (browsers ~2000+; specific limits apply per component).
- Relative vs absolute —
https://pyqdeck.com/papers/cse-sem1is absolute;/papers/cse-sem1or../sem2is relative to the current page.
4. Kinds of URLs
| Type | Form | Note |
|---|---|---|
| Static URL | /papers/cse-sem1 |
Same content every time; cacheable |
| Dynamic URL | /search?q=maths&year=2024 |
Content generated from parameters |
| Pretty / SEO-friendly | /cse-sem1/engineering-mathematics-1 |
Human-readable, better for search engines |
| Deep link | App URL scheme or https deep path |
Opens a specific screen in an app |
| Short URL | bit.ly/xyz |
Redirects (301/302) to the long URL |
| URN | urn:isbn:9783161484100 |
Names a resource without saying how to fetch it |
| Other schemes | mailto:help@pyqdeck.com, tel:+91..., file:///D:/notes.pdf |
Non-web resources |
5. How the Browser Processes a URL
1. Parse the URL into scheme, host, port, path, query, fragment
2. Check the HSTS list / upgrade http → https if required
3. Resolve the host name to an IP address through DNS (and cache it)
4. Open a TCP connection to the IP on the port (443) and complete TLS
5. Send the HTTP request: GET /papers/cse-sem1?year=2024 Host: www.pyqdeck.com
6. Receive and render the response; the FRAGMENT (#notes) is applied
locally by scrolling to the matching element in the page
7. Cache resources according to the response's cache headers
6. URL vs URI vs URN vs Other Identifiers
| Term | Meaning | Example |
|---|---|---|
| URI | Any identifier of a resource (the superset) | https://pyqdeck.com/x, urn:isbn:123 |
| URL | A URI that also tells how to locate the resource | https://pyqdeck.com/x |
| URN | A URI that names the resource permanently, without location | urn:isbn:9783161484100 |
| Domain name | Just the server name, no protocol/path | pyqdeck.com |
| IP address | The numeric address of the machine | 104.21.32.7 |
7. Security and Practical Notes
Check the scheme — https (with a padlock) means encrypted and certificate-verified, http means plain text. Be careful with typosquatting (amaz0n.com) and homograph attacks (Cyrillic а instead of Latin a in a domain), which are why browsers display Punycode for suspicious IDNs. Query parameters can leak sensitive data into logs and browser history, and open redirects in URLs are a common phishing vector. Long, complex URLs with encoded payloads are a classic sign of malicious links.
8. Exam Points
- Define URL; draw and explain its parts with a labelled example — 5-7 marks, almost certain.
- Explain the scheme, host, port, path, query and fragment with one example each — 5 marks, very frequent.
- Differentiate a URL, a URI and a URN — 3-5 marks.
- What is percent-encoding? Convert a given string with a space/& into encoded form — 3 marks.
- What is a FQDN/IDN/Punycode? — 3 marks.
- Trace what happens from typing a URL to the page being displayed — 5 marks.
- Differentiate static and dynamic URLs; what are pretty URLs? — 3 marks.