What is a URL?

Summary
 

With Hypertext and HTTP, URL is one of the key concepts of the Web. It is a method used by browsers to find any service published on the web.

The URL represents the Uniform Resource Locator. The URL is nothing but a unique resource address provided on the web. In a sense, each valid URL points to a different resource. Such resources can be HTML page, CSS documents, images, etc. In practice, there is something different, more often than not a URL that identifies a service that has been lost or moved. Since the service represented by the URL and the URL itself is hosted by a Web server, it is up to the webserver owner to carefully manage that resource and its associated URL.

Basics: URL anatomy
Here are some examples of URLs:

https://developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Learn/
https://developer.mozilla.org/en-US/search?q=URL
Any of these URLs can be typed in your browser's address bar to tell it to load a related page (app).

The URL is made up of different parts, some of which are mandatory and some of which are optional. The most important parts are highlighted in the URL below (details are provided in the following sections):

Scheme
 
The first part of the URL is a program, which sets out the protocol you must use for the browser to request the app (the protocol is the default way to exchange or transfer data around a computer network). Usually, on websites, the rule is HTTPS or HTTP (its unsafe version). Talking to web pages requires one of both, but browsers can also manage other schemes such as mailto: (opens mail client) or FTP: manage file transfers, so don't be surprised if you see such agreements.

Authority


The following follows the authority, separated by a system with the character pattern: //. If any authority includes both domain (eg www.example.com) and port (80), separated by a colon:

The domain indicates which Web server is requested. Normally, this is a domain name, but any IP address can be used again (but this is rare because it is not that simple).
The port shows the "gate" of technology used to access resources on the webserver. It is usually omitted when the webserver uses standard HTTP protocol ports (80 HTTP and 443 HTTPS) to provide access to its resources. Otherwise, it is compulsory.

Complete URLs vs Related URLs


What we saw above is called the full URL, but there is also the so-called related URL. Let us examine what that separation means in more detail.

Required components of a URL depend largely on the context in which the URL is used. In your browser's address bar, the URL has no context, so you should provide a complete (or complete) URL, such as the one we saw above. You do not need to enter any protocol (the browser uses HTTP by default) or port (only required when a targeted Web server uses an unfamiliar port), but all other URL components are required.

When a URL is used within a document, such as an HTML page, things are very different. Because the browser already has the document URL, we can use this information to fill in the missing parts of any URL found within that document. We can only distinguish between the full URL and the related URL by simply looking at the URL path. If part of the URL path starts with the letter "/", the browser will download that resource from the top root of the server, regardless of the context provided in the current document.

Let's look at some examples to make this clear.

Published on: 2/12/21, 11:32 AM