What is a URL?
A URL (Uniform Resource Locator) helps identify the address of a resource on the computer network and the method of obtaining it.
Here’s the format of a typical URL:
Here’s an example URL:
The different parts of a URL
URLs consist of the following parts.
(http). The scheme describes how the resource can be obtained (i.e., via which protocol – HTTP, HTTPS, FTP, etc?).
- Host: (
google.com)The host identifies the location of the computer on the network. The format of the host will depend on the scheme. For example, if the scheme is HTTP or HTTPS, the host will usually be a domain name such as google.com that in turn points to an IP address such as
- Query string: (
?q=tokyo+population) The query string is usually interpreted, if at all, by the application on the server. In the above example, the Google search engine is programmed to interpret
q=tokyo+populationto mean the user is requesting search results for the term
- Port: this describes the port at which the host is listening for incoming HTTP requests. This is usually either 80 (HTTP) or 443 (HTTPS) in which case you can omit them when using most browsers or client libraries.
- Fragment: the fragment is the part after the hash sign ( e.g.,
https://sajadtorkamani.com/posts/#mysql) and is used to focus a web page on a particular HTML element using its ID.