People talk about URLs, URIs and URNs as if they're different things, but they look the same to the naked eye.
What are the distinguishable differences between them?
People talk about URLs, URIs and URNs as if they're different things, but they look the same to the naked eye.
What are the distinguishable differences between them?
URI is kind of the super class of URL's and URN's. Wikipedia has a fine article about them with links to the right set of RFCs.
A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.
A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://stackoverflow.com, etc. But a URL doesn’t have to be an HTTP URL, it can be
ftp://example.com
, etc.Easy to explain:
Lets assume the following
URI is your Name
URL is your address with your name in-order to communicate with you.
my name is Loyola
Loyola is URI
my address is TN, Chennai 600001.
TN, Chennai 600 001, Loyola is URL
Hope you understand,
Now lets see a precise example
http://www.google.com/fistpage.html
in the above you can communicate with a page called firstpage.html (URI) using following http://www.google.com/fistpage.html(URL).
Hence URI is subset of URL but not vice-versa.
These are some very well-written but long-winded answers. Here is the difference as far as CodeIgniter is concerned:
URL - http://example.com/some/page.html
URI - /some/page.html
Put simply, URL is the full way to indentify any resource anywhere and can have different protocols like FTP, HTTP, SCP, etc.
URI is a resource on the current domain, so it needs less information to be found.
In every instance that CodeIgniter uses the word URL or URI this is the difference they are talking about, though in the grand-scheme of the web, it is not 100% correct.
In summary: a URI identifies, a URL identifies and locates.
Consider a specific edition of Shakespeare's play Romeo and Juliet, of which you have a digital copy on your home network.
You could identify the text as
urn:isbn:0-486-27557-4
.That would be a URI, but more specifically a URN* because it names the text.
You could also identify the text as
file://hostname/sharename/RomeoAndJuliet.pdf
.That would also be a URI, but more specifically a URL because it locates the text.
*Uniform Resource Name
(Note that my example is adapted from Wikipedia)
They're the same thing. A URI is a generalization of a URL. Originally, URIs were planned to be divided into URLs (addresses) and URNs (names) but then there was little difference between a URL and URI and http URIs were used as namespaces even though they didn't actually locate any resources.