URL (Uniform Resource Locator) Basics
A URL is a standardized addressing scheme designed to locate a specific resource (a web page, image, file, etc.) on the internet. It is the fundamental concept used to request any information from a web server.
1. Components of a URL
A URL is composed of several parts, each providing necessary information for the browser and server to find the resource.
scheme://host:port/path?query#fragment
| Component | Example | Role |
|---|---|---|
| Scheme (Protocol) | https |
Specifies the method (communication protocol) to access the resource. (http, ftp, etc.) |
| Host | www.google.com |
The domain name or IP address of the web server being accessed. |
| Port | :80 or :443 |
The logical number where a specific service is running on the server. (Often omitted) |
| Path | /search/results |
Specifies the location of the file or resource requested on the server. |
| Query | ?q=hello&lang=en |
Additional data sent to the server, typically in key=value pairs. Used for filtering or searching. |
| Fragment | #toc |
Directs the browser to a specific section (anchor) within the web page. This data is not sent to the server. |
2. URL Processing Flow
- Protocol Check: The browser determines the communication method (
httpsmeans encrypted). - DNS Resolution: The host name (
example.com) is translated into an IP address using DNS (Domain Name System). - Server Connection: The browser connects to the server at that IP address and port (default 443).
- Resource Request: The browser sends a request to the server, including the path and any query data, to retrieve the desired resource.