The World Wide Web can be conceived as a large group of resources or contents placed in different computers all around the world. These contents can be found and can link each other through URIs. As its name describes, identifies resources assigning them addresses in a given network.
URL, is a type of URI that's used to describe the location of a specific document. A URL doesn't define the type of content to be found (texts, images, movies, etc.), it only says where and how to find it. A common URL is composed by four parts:
This way we can analyze any given URL:
http | :// | www.htmlquick.com | / | reference | / | uris.html |
Protocol | Domain name | Directories | File |
---|
Some URLs may not contain any directory, and some other parts of it can be omitted depending on the situation. For example, when the file is not defined in an HTTP request, web servers automatically send default files (e.g., index.htm). Also, when typing a URL in some browsers, if the protocol is absent (e.g., www.servername.com/index.php), the empty space is automatically replaced by the HTTP protocol prefix (http://).
Examples of URLs:
ftp://someserver.com/some-res.php (no directories defined)
http://www.w3.org/TR/CSS21/ (no file specified)
http://www.htmlquick.com/reference/tags/a.html
Relative URIs are partial URIs used to refer to a document from another one in the same computer. This way we can define a relative URI as the path to follow from the actual document's location (directory path) to the destination resource's location, plus its file name.
Supose that the actual document, located at "http://webserver.es/documents/index.asp", needs to point to a document located at "http://webserver.es/documents/new/best/two.asp". The relative URI to refer to that resource from the actual document will be: "new/best/two.asp"
The special directory ".." provides a way to go back to the parent directory. So, to point from "http://newwebserver.mil/documents/new/best/res.htm" to "http://newwebserver.mil/documents/old/best/june.htm", the relative URI will be: "../../old/best/june.htm"
For more information about interlinking resources, please refer to our Organizing a website tutorial.