Routing (URL Matching/Redirect) discusses the routing process and provides an example implementation.
Given the several questions received regarding the URI and URL expressions mentioned in the article, an additional piece of content explaining their equivalents will be appropriate.
URI (Uniform Resource Identifier)
URI (Uniform Resource Identifier) is a character string that serves as a precise identifier for a resource (such as a document, image, file, etc.) and follows a standardized format for such identification. URIs are subtypes within the URL scope. For example, a page, an image, or a file could be represented as a URI; such as http://examplewebsite.com/logo.png, or ISBN 0-486-27557-4. URI encompasses two categories: URL and URN. Both URNs (names) and URLs (locators) are considered URIs, and a specific URI can simultaneously serve as both an identifier and a locator.
URL (Uniform Resource Locator)
URL (Uniform Resource Locator) can also be referred to as a Uniform Resource Locator or a Resource Locator. The location of resources accessible via the Internet (such as files, documents, etc.) is specified using a URL. Technically, a URL forms the initial portion of a URI. Structurally, a URL is followed by a URN. However, when a location is specified, the URL expression is typically used instead of a URI. The syntax of a URI is as follows:
scheme://domain:port/path?query_string#fragment_idscheme://user:password@host:port/path?query_string#fragment_id
A URL specifies both where a resource is located and how to access it. It can support many protocols such as http:// and ftp://. When illustrating the relationship between URL and URN through an address specification, a URL identifies a location, while a URN identifies the name of the resource at that location. For example, telnet://192.0.2.16:80/ is a URL, whereas tel:+1-816-555-1212 is a URN.
A source is uniquely and permanently identified by a name, but it is not necessary to specify how one can find it on the Internet. Beyond merely defining documents, URNs can also define concepts and ideas. A URN typically begins with the urn: prefix.
urn:isbn:0451450523refers to a book by ISBN.urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66is a globally unique identifier.urn:publishing:bookis an XML namespace that defines a document as a book.
Further Reading
- The Difference Between URLs, URIs, and URNs
- What’s a URI and why does it matter?
- What is the difference between a URI, a URL and a URN?, @stackoverflow [2]
- Difference between URI, URL and URN
- URIs, URLs, and URNs: Clarifications and Recommendations 1.0, @w3
- Uniform Resource Identifier (URI) Schemes
- Examples of URI, URL and URN
- URL vs URI vs URN
- What’s different between URI, request-URI and URL?, @stackoverflow
- Uniform Resource Identifier (URI): Generic Syntax