Each file or document on the Internet is located at a unique address called a URL (Uniform Resource Locator). The term URI (Uniform Resource Identifier) is sometimes used interchangeably with a URL, although it is a more general term.
The URL allows different devices connected to the Internet to find a specific file on a particular server to download and display the file to the user (or use it for other purposes: not all files are intended for Display).
Any URL follows a standard form that can be broken down into several basic parts (the diagram is presented in the image). Each segment communicates specific information to the client and server.
The protocol specifies one of several different sets of rules that define the transmission of data over the Internet. The web uses the standard hypertext Protocol, which is used to transfer data encoded hypertext from one computer to another. The protocol is separated from the rest of the URL by a colon and two slashes (
Domain name and subdomains
Hostname is the name of the site from which the browser will retrieve the file. The true address of the Web server is a unique number of Internet protocol (IP), and every computer connected to the Internet has one IP address (something like "
220.127.116.11"), which is certainly not very easy to remember. A domain name is a more memorable alias that directs traffic from the Internet to an IP address. Many web hosts have a prefix in front of the domain name followed by the specific server that is being accessed (especially when there are multiple servers in the same domain). The prefix can be any, the most common prefix is of course
. This allows the existence of several separate sites on the same domain, but having different subdomain prefixes. Hostname also contains a domain suffix that specifies the category of domains, for example, "
.org" for sites of different organizations. Each country also has its own domain extension and you will often see URLs that point to the country rather than to any category.
The path specifies the directory (folder) on the web server that contains the requested document. Files on the web server can be stored in subdirectories (child folders) located inside other folders, and each directory in the path is separated by a slash (
). A path is a route that the client will follow to reach the target file. The top-level directory of the website (the one that contains other files and directories) is called the root directory of the site and does not appear in the URL.
File name and extension
Specific files to retrieve are identified by file name and extension. You can set your file to any desired name, and the file extension will point to the file type. HTML documents (or XHTML) will have an
.htm extension (a shorthand version is used on some servers that support only three letters in the extension). CSS files use the
.js, and so on. Web servers Configure the recognition of these extensions and process files accordingly, processing different types of files in different ways.
Most likely you will not see the file name and its extension in each URL with which you encounter. Most Web servers configure to automatically detect a specially named file when a directory is requested without a specified file name. This can be a file
default.html or some other name, depending on the server settings. Indeed, most different parts of a URL may be dependent on the configuration of a particular server.
A URL is a tool that allows you to create links to other files on the Internet, including other files on your own site. You often have to use URLs in HTML and CSS.