Structure of a URL

Structure of a URL

A URL (Uniform Resource Locator) is a web address used to access resources on the Internet. The structure of a URL can vary depending on the case and assumptions included. It's important to keep these components in mind when working with URLs. Below, I will show you an example of the complete structure of a URL with all the assumptions it can include.

Example of a complete URL:

https://www.web3hispano.com:8080/path/subpath?parameter1=value1&parameter2=value2#fragment

Let's look at the parts that make up this URL:

Scheme or Protocol

The scheme indicates the protocol used to access the resource. In this example, the scheme is "https", which is the Hypertext Transfer Protocol Secure.

Other protocols

HTTP (Hypertext Transfer Protocol): This protocol was used until recently (now replaced by https) for data transfer on the web. It is an insecure protocol, meaning that the transferred data is not encrypted and can be intercepted by third parties.

FTP (File Transfer Protocol): This protocol is used for the transfer of files between a client and a server on a network. It is mainly used to upload and download files on remote servers.

mailto: This protocol is used to create email links. Clicking on an email link with the "mailto" protocol will automatically open the user's default email client with the specified email address in the "To" field.

Authority

The authority includes the domain name and, optionally, the port number. In this example, the authority is "www.web3hispano.com:8080". The domain name is "web3hispano.com" and the port number is "8080". In this case, "www" is a subdomain commonly used to identify the web server of a site. It is important to note that not all websites use "www" as a subdomain. Some sites may choose to use other subdomains or even do without them entirely.

Path

The path specifies the location of the resource on the server. In this example, the path is "/path/subpath".

Query Parameters

Query parameters are used to send additional information to the server. In this example, the query parameters are "parameter1=value1&parameter2=value2". These are optional components of a URL used to send or request additional information from the server. These parameters are added at the end of the URL after the question mark "?" and consist of key-value pairs separated by the "&" symbol. Query parameters are useful for customizing and filtering the results of a request to the server. For example, in a search URL on a website, query parameters can include search keywords, date filters, sorting of results, among others. Here is an example of a URL with query parameters:

https://www.web3hispano.com/search?keyword=example&filter=date&order=asc

In this example, the base URL is "https://www.web3hispano.com/search". The query parameters are "keyword=example", "filter=date", and "order=asc". Each parameter has a name (key) and an associated value. In this case, the "keyword" parameter has the value "example", the "filter" parameter has the value "date", and the "order" parameter has the value "asc". Query parameters can be used by the server to perform specific actions, such as conducting searches, filtering results, paginating information, among others. The server can read these parameters and use them to generate a customized response. Query parameters can vary depending on the website or service being accessed. Each website or service may have its own defined query parameters.

Fragment

The fragment is used to identify a specific section within the resource. In this example, the fragment is "#fragment". It is an optional part of the URL used to identify a specific section within the accessed resource. The fragment is indicated in the URL with the hash symbol "#" followed by an identifier or name. Example of how a fragment is used in a URL:

https://www.web3hispano.com/page#section

In this example, the base URL is "https://www.web3hispano.com/page" and the fragment is "section". The fragment is used to indicate a specific section within the page being accessed. Clicking on a link with this fragment will automatically scroll the web browser to the corresponding section within the page. It is important to note that the fragment is processed only on the client side, that is, in the web browser. It is not sent to the server when making an HTTP request. Therefore, its main function is to provide a way to link directly to a specific section within a web page.