1. What is a URL?
URL stands for Uniform Resource Locator.
It is a web address that helps locate resources on the internet.
Understanding URLs is essential for web development.
2. Components of a URL
A URL consists of the following major components:
a) Protocol
The protocol defines how communication happens between the browser and the server.
Common protocols:
HTTP (HyperText Transfer Protocol) – Standard communication protocol.
HTTPS (Secure HTTP) – Encrypts communication using an SSL certificate for security.
WS (WebSocket Protocol) – Used for real-time communication.
b) Domain Name
The domain name is the human-readable version of an IP address.
Websites are hosted on servers with specific IP addresses.
The domain maps to the IP address using DNS (Domain Name System).
Example:
google.com
→ Mapped to an IP address.
c) Path
The path specifies a particular resource on the server.
Example:
/about
→ Refers to the "About" page./contact
→ Refers to the "Contact" page.Nested Paths:
/projects/tiktok
– Nested path structure.
d) Query Parameters
Query parameters provide additional information to the URL.
They follow the
?
symbol and consist of key-value pairs.Example:
?q=nodejs
is a query parameter.
Multiple parameters can be separated using
&
.Example: