URI vs URL vs URN
The URL stands for Uniform Resource Locator, is a widely used term on the web to define a particular web address. However, there are other terms that can sometimes be used more appropriately when referencing an online resource. They are URI and URN. URI stands for Uniform Resource Identifier and URN stands for Uniform Resource Name.
URL stands for Uniform Resource Locator and it is a subset of URI. URL includes location as well as the protocol to retrieve the resource.
E.g. in https://poopcode.com, HTTPS is a protocol which can be used to retrieve poopcode’s homepage..
In ftp://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.4.tar.gz, FTP is a protocol which is used for file transfer.
The protocols that can be included in a URL are http, https, ftp and ldap.
After the domain name, the URL can also optionally specify
- a path to a particular page or file within a domain;
- a network port to use to make the connection;
- a specific reference point within a file, such as a named anchor in HTML; and
- a query or search parametersin URLs for search results.
URN stands for Uniform Resource Name. URN is also the subset of URI. URN doesn’t define any protocol and it does not define how the resource may be obtained. You may see URNs used in XML Schema documents to define a namespace.
Some examples of URN quoted from Wikipedia.
urn:isbn:0451450523 corresponds to the 1968 book The Last Unicorn, identified by its book number.
urn:isan:0000-0000-2CEA-0000-1-0000-0000-Y corresponds to the 2002 film Spider-Man, identified by its audiovisual number.
urn:ISSN:0167-6423 corresponds to the scientific journal Science of Computer Programming, identified by its serial number.
urn:ietf:rfc:2648 corresponds to the IETF’s RFC 2648.
URI stands for Uniform Resource Identifier. URI is a text which identifies any resource or name on Internet. URI has two specializations in the form of URL (Uniform Resource Locator) and URN (Uniform Resource Name) to identify resource and name. So URI is basically a superset of URL and URN.