What is a URL (Uniform Resource Locator)?
In this tutorial, we are going to see What is a URL (Uniform Resource Locator)? A URL (Uniform Resource Locator) is a universal naming format for designating a resource on the Internet. It is a string of printable ASCII characters that is split into five parts:
- Protocol name: this is the language used to communicate on the network. The most widely used protocol is HTTP (HyperText Transfer Protocol), the protocol that allows the exchange of Web pages in HTML format. Many other protocols are however usable (FTP, SFTP,…)
- Username and password: this allows you to specify the access parameters to a secured server. This option is not recommended because the password is visible in the URL
- Server name: This is the domain name of the computer hosting the requested resource. Note that it is possible to use the IP address of the server, which makes the URL less readable.
- Port number: this is a number associated with a service allowing the server to know what type of resource is requested. The default port associated with the protocol is port number 80. Thus, when the server’s Web service is associated with port number 80, the port number is optional
- Access path to the resource: This last part allows the server to know the location where the resource is located, i.e. usually the location (directory) and the name of the requested file
A URL has the following structure:
http:// | user:password@ | www.stackhowto.com | :80 | /blog/what-is-url.php |
The file name in the URL can be followed by a question mark and then by data in ASCII format, this is additional data sent as a parameter to an application on the server (a CGI script for example). The URL will then look like this one:
http://www.stackhowto.com/app/?age=1&name=alex