URL Anatomy and the RFC 3986 URI Specification
A Uniform Resource Locator (URL), defined by the IETF standard RFC 3986, is the universal addressing mechanism for web resources. Beyond human-friendly web addresses, URLs encapsulate strict syntax hierarchies with percent-encoding rules to prevent injection attacks and ensure reliable parameter parsing across disparate networks.
1. The Core Building Blocks of a URI
- Scheme / Protocol: Specifies the underlying communications protocol (
https://,http://,wss://,ftp://). - Host / Domain: Destination IP address or fully qualified domain name (FQDN, e.g.,
api.caixadodev.com.br). - Port: Network endpoint connection number (defaults to 80 for HTTP and 443 for HTTPS).
- Pathname: Hierarchical routing path to the resource inside the destination application (e.g.,
/v1/users/profile). - Query String: Key-value pairs introduced by
?and delimited by&(e.g.,?category=tools&page=2). - Fragment / Anchor: Identified by
#, designating a client-side component or section never transmitted to the origin web server in HTTP requests.
2. What is Percent-Encoding (URL Encoding)?
Because characters such as /, ?, &, =, and whitespace serve structural functions in URLs, user-supplied data matching these symbols must be percent-encoded into UTF-8 hexadecimal sequences preceded by % (for example, spaces become %20 or +, and quotes become %22).