URL Components Explained: Scheme, Host, Port, Path, Query, Fragment
Learn what each part of a URL does: protocol, subdomain, domain, TLD, port, path segments, query string, and the hash fragment — with real-world examples.
Published:
Tags: url, developer-tools, web
URL Components Explained: Scheme, Host, Port, Path, Query, Fragment A URL has six or seven distinct components, and each one has its own encoding rules, parsing semantics, and common failure modes. Knowing them precisely prevents a category of bugs that are easy to introduce and hard to diagnose. This is a deep dive — one section per component. Host The host identifies the server. It can be a domain name, IPv4, or IPv6 address. Three valid forms: Case normalization: Host names are case-insensitive. The URL API normalizes to lowercase: Punycode (internationalized domains): Non-ASCII hostnames are encoded with Punycode. The URL API handles this transparently: Subdomains and origins: and are different origins but share a registrable domain (). This matters for: Cookie attribute: setting…
All articles · theproductguy.in