>[!quote] In a Nutshell
>Address used to access resources in a network, e.g. the internet. It specifies the location of a resource and how to retrieve it.
>It is used as a standardized way of referring to websites, files, services, or other types of data available in the network.
---
#### Structure
A typical URL looks like this:
```bash
scheme://host:port/path?query#fragment
```
For example, a full URL could look like this
```bash
https://www.example.com:8080/products/search?category=electronics&sort=price#reviews
```
| Component | Description | Example |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
| **Scheme** | Protocol or method of accessing the resource (e.g., `http`, `ftp`, `mailto`) | `https://` |
| **Host** | [[DNS and DDNS - (Dynamic) Domain Name System\|Domain name]] or [[IP Address, IPv4, IPv6, ULA and Subnet Mask\|IP address]] of the server where the resource is located | `www.example.com`, |
| **Port** | Specifies the [[Port\|port number]] on the server (optional) | `:8080` |
| **Path** | The location of the resource on the server (like a file path) | `/products/search` |
| **Query** | A string of parameters that provide additional information to the server (optional) | `?category=electronics&sort=price` |
| **Fragment** | An internal section of the resource (optional) | `#reviews` |
---
##### 1. **Scheme (Protocol)**
- This specifies the protocol or method used to access the resource.
- Examples:
- `http`: [[HTTP and HTTPS - Hypertext Transfer Protocol|HyperText Transfer Protocol]], used for standard web pages.
- `https`: Secure version of [[HTTP and HTTPS - Hypertext Transfer Protocol|HTTP]], where the data is encrypted.
- `ftp`: File Transfer Protocol, used to transfer files between computers.
- `file`: Refers to a local file on the system.
- `mailto`: Opens an email client to send an email.
- `udp`: [[UDP - User Datagram Protocol|UDP]], used for low-latency communications (e.g., [[LCM - Lightweight Communications and Marshalling||LCM]]).
- `ws`: WebSocket, used for bidirectional communication in web applications.
##### 2. **Host (Domain or IP Address)**
- This is the address of the server where the resource is hosted. It can be a **domain name** (e.g., `www.example.com`) or an **[[IP Address, IPv4, IPv6, ULA and Subnet Mask|IP address]]** (e.g., `192.168.1.1`).
##### 3. **Port (Optional)**
- This specifies the **[[Port|port number]]** on the host that is used for communication.
- The **default ports** are often implied based on the protocol:
- `http` uses port `80`.
- `https` uses port `443`.
- `ftp` uses port `21`.
##### 4. **Path**
- The **path** identifies the specific resource or location on the server you want to access (like file path in a file system)
##### 5. **Query String (Optional)**
- The **query** part of the URL contains parameters or arguments that are passed to the resource. It usually follows a question mark (`?`).
- Multiple parameters are separated by an ampersand (`&`).
- Often used in web applications to send data to the server (e.g., search queries, user identifiers, etc.).
##### 6. **Fragment (Optional)**
- The **fragment** is an optional part of the URL, usually following a hash symbol (`#`), which points to a specific section or element within the resource.
- It’s commonly used in web pages to navigate to a specific part of the document, such as a heading or a div.