A URL or Uniform Resource Locator is the link or address used to identify all kinds of web resources available to Internet users.
It can specify the location of a digital resource such as a site or image on a computer network and also provide a way of accessing it, such as by clicking on it.
In theory, each valid URL points to a unique resource. Such resources could be an HTML page, a CSS document, an image, etc.
Here is an example of a URL:
A URL is composed of various parts, some of which are compulsory and others optional. The most important parts include:
The first part of the URL is the scheme, representing the browser’s protocol to retrieve a specific resource (a protocol is a set method for exchanging or transferring data around a computer network).
Usually, for websites, the protocol is HTTPS or HTTP (its unsecured version). Addressing web pages requires one of these two, but browsers also know how to handle other schemes such as mailto: (to open a mail client) or FTP: to handle the file transfer.
Next comes the authority, which is separated from the scheme by the character pattern ://. If present, the authority will include both the domain (e.g., www.Google.com) and the port (80), separated by a colon.
The domain indicates which Web server is being requested. Usually, this is a domain name, but an IP address may also be used (even though that is rare as it is much less convenient).
The port indicates the technical "gate" used to access the resources on the web server. It’s usually omitted if the web server uses the standard ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise, it’s always required.
/path/to/myfile.html is the path to the resource on a Web server. When the Web was first invented, a path such as this would represent a literal physical file location on the Web server. But now, it’s a signal of the digital address and is mostly an abstraction.
?key1=value1&key2=value2 are extra parameters provided to the Web server. These parameters are a list of key/value pairs separated with the & symbol. The Web server can use them to perform additional actions before returning a resource.
Each Web server has its own rules regarding parameters. The only reliable way to know if a specific Web server handles parameters is by asking the Web server owner.
#SomewhereInTheDocument is an anchor to another part of the resource itself. An anchor represents a "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot.
For instance, on an HTML document, the browser will scroll to where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It should also be noted that the part after the #, also known as the “fragment identifier”, is never sent to the server with the request.
URLs can help create separate pieces of content and publish them on the Internet, and track different sources. They’re essentially the “address” of a piece of digital content and allow search engines to guide Internet users to your site.