Network & Ops · Ch. 1
URL Anatomy: Scheme, Port, Path, Query String, and Fragment
WebTool Team · Published 2026-09-08 · URL / HTTP / Frontend / Networking
A complete URL has seven parts: scheme, host, port, path, query string, and fragment (plus optional user info). The browser only sends "everything before the fragment" to the server — whatever follows # never leaves the browser. Paste a complex URL into our URL parser to see it broken down segment by segment.
Segment by segment
https://user:pass@example.com:8443/path/to/page?id=1&lang=zh#section-2
\___/ \_______/ \_________/ \__/ \_________/ \___________/ \_______/
scheme user info host port path query fragment
| Part | Meaning | Notes |
|---|---|---|
| Scheme | https, http, ftp, etc. | Determines the default port and security semantics |
| User info | Deprecated; seen mostly in documentation | Never use it to pass credentials |
| Host | Domain name or IP | Case-insensitive |
| Port | Defaults when omitted (http 80 / https 443) | Default ports are not displayed |
| Path | Resource location on the server | Starts with / |
| Query string | ?k=v&k2=v2 |
Pairs separated by &; values need URL encoding |
| Fragment | Everything after # |
Never sent to the server; commonly used by frontend routers |
Absolute vs. relative paths
When the page is at https://a.com/docs/guide/:
<a href="page2">→https://a.com/docs/guide/page2(relative to the current directory)<a href="/page2">→https://a.com/page2(relative to the root)- Watch the trailing
/:/docs/guideand/docs/guide/resolve relative paths differently — a missing slash on a directory page is a classic cause of resource 404s.
The three most common pitfalls
- Unencoded
&in the query string: a value containing&gets split into two parameters (see Chapter 3 of the Encoding series). - Lost fragments: if a server-side redirect doesn't explicitly preserve
#..., the fragment disappears — it was never in the request, so the server has nothing to forward. - Case confusion: hostnames are case-insensitive, but paths and query strings are case-sensitive —
/Pageand/pageare different addresses, which matters especially on Linux servers.
Last updated: 2026-09-08