URI (Uniform Resource Identifier)
- A general concept: any string that identifies a resource.
- It can be a name, a location, or both.
- Examples:
https://example.com/path(this is also a URL)/path/to/resource(just a path — this is a relative URI)mailto:[email protected]urn:isbn:0451450523(a book identifier — not a URL)
URL (Uniform Resource Locator)
- A specific type of URI.
- It locates (provides the address for) a resource on the internet.
- It always includes the protocol (
http://,https://, etc.) and usually a domain/host, plus the path.
Key relationship
Every URL is a URI, but not every URI is a URL.
Common breakdown of a full URL
https://www.example.com:443/path/to/resource?query=param#fragment
└────┬────┘ └────┬────┘ └──────┬──────┘
Protocol Host Path
- The pathname part (
/path/to/resource) is just one component of a URL/URI. - Both URL and URI can include or omit the path depending on context.
Quick summary table
| Term | Includes protocol + domain? | Purpose | Example |
|---|---|---|---|
| URI | Not necessarily | Identify | /users/123, urn:isbn:1234 |
| URL | Yes | Locate on network | https://example.com/users/123 |