Parts of a URL Explained With an Example
A web URL can contain a scheme, host, port, path, query and fragment. Each part has a different role in choosing a resource or presenting it.
One URL, six parts
https://example.com:8443/guides/address?lang=en#format
Connection and destination
- Scheme
httpsHow to connect. HTTPS uses an encrypted connection.
- Hostname
example.comThe server name used in this example.
- Port
8443A non-default service port. The colon introduces it.
Resource path
- Path
/guides/addressThe resource path on the server. Its meaning is chosen by the website.
Query and fragment
- Query
lang=enParameters after ?. Here, lang has the value en.
- Fragment
formatA section or client-side identifier after #. It is not sent in the HTTP request target.
Defaults may be invisible
HTTPS normally uses port 443 and HTTP uses 80. Browser URL serialization removes an explicitly specified default port, so normalized text can differ from the original input.
Queries and fragments differ
A query begins after ?. A fragment begins after # and is not part of the HTTP request target sent to the server, although browser scripts can read it.